Posted by editor
on November 17, 2005 at 8:43 AM PST
So long, getContentPane().add()... also:
Weblogs: The real story of getContentPane(), Java quality metrics, and Java interoperability
Feature Article: App-Managed JDBC DataSources with commons-dbcp
Forum postings: Media sessions at JavaOne 2006 and critiquing the criticisms of Java
Also in Java Today: SOA session outburst and SDN expert assistance program
Projects and Communities: Jini Webinar #10 and JavaTools Newsletter #62
So long, getContentPane().add()
If you've seen Graham Hamilton's blog entry My Favorite (Dead) Java Boilerplate , then you know about how Mustang will obsolete the following boiler-plate Swing code:
JFrame f = new JFrame ("Sample");
JButton b = new JButton ("OK");
In earlier versions of Java, if you just did
it would compile, but you'd get a runtime exception.
OK, time to ask: why?
Hans Muller owns up to it, and has an explanatory history, in his weblog post JFrame.add() contentPane Pain: The Complete Story :
The 1.0 and 1.1 releases of Swing were delivered on the original Java 1.x platform. Our audience was AWT developers who typically wrote small apps by subclassing java.awt.Frame and overriding paint() or setting its layout manager and adding children. When we decided to create JFrame's substructure there was a debate about the wisdom of automatically mapping JFrame.add() to JFrame.getContentPane().add(). The reason I rejected that approach is that this "convenience" is a shallow illusion. To complete the illusion one would have to redirect get/setLayout(), and addComponentListener(), and getComponent() and getChildren() and so on. In addition to making it tough to actually get inside the JFrame itself, the complete illusion would be asymmetrical since the source of events or a layout manager's container wouldn't match what a developer would expect. So in the interest of consistency, not education, we did not automatically redirect JFrame.add() to the content pane.
Also in today's Weblogs Konstantin I. Boudnik returns with Java. Quality. Metrics (part 4) , which offers "more about quality methods and stuff ... we can use a few methods to insure our product quality and guarantee that we're digging at least in right direction. Another one I was about to mention is code coverage."
Arun Gupta discusses interoperability in
Sun (sleepless) in Seattle :
"Although it drizzled in Seattle most of last week, but Sun was prominent at least in one corner. 5 of us (Harold, Vivek, Mike, Manveen and myself) from Sun Microsystems attended the Microsoft hosted plugfest last week. This is part of Sun's effort to improve interoperability between Java and Microsoft's Windows Communication Foundation or WCF (a.k.a. Indigo)."
In our Featured Article , App-Managed JDBC DataSources with commons-dbcp , Ethan McCallum looks at managing your own database connection pool: "Need a connection pool but maybe not one provided by a container? This need still comes up in special cases--tightly managed environments, CD-ROM distribution, etc.--and there's no need to reinvent the wheel yourself. Ethan McCalllum shows how the Apache Commons package commons-dbcp can help."
has a JavaOne 2006 request Re: Desktop
in today's Forums
"Media presentation and management applications that include videos, photos and music. This is what a lot of people are using computers for. We are developing one such app and will be most happy to showcase it at JavaOne 2006 to show the power of Java2D and JSR-231."
In the Book Club forum,
rickcarson is unimpressed by criticisms of Java. In
Re: Chapter 4: Glass Breaking , he writes:
"As for the choices that people make, you cannot legislate against stupidity. But, in most cases, did the people involved deliberately set out to make the worst possible decision? No, probably not. So what is the cause of the problem? Is it not that we have all these pundits and experts (self proclaimed usually), who tout the latest 'silver bullet' solution to all that ails us - whether that is Struts, Agile programming, XML or whatever. (See also: todays Dilbert)"
In Also in
Java Today ,
David A. Chappell's XML.com blog entry ESB vs Biztalk Debate Gets Heated in Barcelona relates a stunning story of how his SOA-oriented conference presentation was interrupted by a Microsoft Evangelist. "While giving a presentation at the Enterprise Architect Summit in Barcelona, on the subject of ESB and other SOA-related infrastructures, I got into a public altercation with a couple of Microsoft guys who were in the audience. It turned into a pretty heated debate over core architectural fundamentals, which we hammered out in front of an audience of about 75 unsuspecting conference-goers. I have to say that in all my years of public speaking this sort of spontaneous public debate has never happened quite like this. The conversation that ensued brought to light some really important issues regarding some fundamental differences between the use of an ESB as the foundation of building a Service Oriented Architecture vs. using a combination of Biztalk and WCF (formerly known as Indigo)."
The Sun Developer Network Expert Assistance for Developers is offering help from the source: the J2SE engineers themselves. The program allows SDN members to send in a question about Java Studio Creator, J2SE 1.4 or 5 (core - no desktop), and, starting in December, Sun Studio 10 or 11 for Solaris and Java Studio Enterprise 7 or 8. E-mailed questions will receive a reply from a J2SE engineer within 24 hours. During the beta period, the service is free.
In Projects and
the tenth Jini Community Webinar takes place Wednesday, November 30, and features Codemesh's Alex Krapf on "C++ Legacy Integration With Jini Technology". "This Webinar will discuss problems that are commonly encountered in such a situation and describe integration and porting approaches that can be used to move forward, adopt Jini technology, all while maintaining your C++ legacy application."
The sixty-second issue of the weekly JavaTools Community Newsletter welcomes seven new projects to the community, and makes a call for input on JavaOne 2006 activities. The weekly tool tip is on running free software projects, and points to Karl Fogel's online book Producing Open Source Software - How to Run a Successful Free Software Project , available for free under an "open copyright".
In today's java.net
News Headlines :
Registered users can submit news items for the
href="http://today.java.net/today/news/">java.net News Page using our
form . All submissions go through an editorial review before being
posted to the site. You can also subscribe to the
href="http://today.java.net/pub/q/news_rss?x-ver=1.0">java.net News RSS
Current and upcoming Java
Registered users can submit event listings for the
href="http://www.java.net/events">java.net Events Page using our
href="http://today.java.net/cs/user/create/e">events submission form.
All submissions go through an editorial review before being posted to the
Archives and Subscriptions: This blog is delivered weekdays as
Today RSS feed . Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the
So long, getContentPane().add()