Skip to main content

Roots Radical

Posted by editor on February 2, 2009 at 8:14 AM PST


Calling for a Swing cleanup

A number of Java blogs and news sites are linking to Jonathan Giles' Java Swing 2.0 blog:

I believe that there is a need for a proper Swing 2.0 which is not JavaFX-based, but a true, desktop focused, Java (the language)-based framework. My vision is one shared by numerous others, and in a brief discussion (via twitter no-less), a number of us enumerated what we believe a Swing 2.0 needs. The following list is a brief overview of what Swing 2.0 should be...

The interesting thing about Jonathan's list is that it's all about the plumbing: support for enumerations and varargs where appropriate, smarter use of collections, generics-based, and enforcing the event-dispatch thread rules. There's nothing in here that you'd actually see onscreen in a Swing 2.0. Jonathan writes, "What you may note is missing is any mention of new components, new Look and Feels, etc. That is not my interest - in my opinion Swing 2.0 is a cleanup of the code beneath the existing Swing components."

It's interesting to note that Jonathan's bio lists him as being 24 years old... since Swing came out back in 1998 -- when he would have been, what, 14? -- it's entirely possible that he only came to Swing much later in its lifetime. And with fresh eyes and without baggage or preconceptions, the Swing design decisions of 10 years ago may not hold up anymore. I mean, after all, public JList(Vector<?> listData)... seriously?

So what do you think? Rework Swing's plumbing before we even talk about adding tree-tables, cover flows, image pickers and other modern components? Or are we to give up on Swing and look to JavaFX as the reboot of the Java GUI?


Also in Java Today,
PointLayout is a new layout manager designed to make the GUI development process simpler and more inuitive. It is one of the few gridless layout managers available. By being gridless, it offers a lot more control for a lot less code. Project owner Ryan Williams writes, " While my initial design is mostly complete - I would like to know what the Java community thinks of it. Is it easy to use? Is it powerful enough to meet all of your GUI development needs? What features would you like to see added? Are there any bugs? I want this to become a powerful (and hopefully well known) alternative to the other layout managers out there."

Brad Wetmore has posted an Update on the OpenJDK Bugzilla instance. "I've recently been leading the effort to get our OpenJDK Bugzilla instance in place, and just wanted to let folks know that we're pretty close. I took some time over the last couple days to take a snapshot of what we have and what's planned for the near and somewhat longer future. The short story is that we'll begin by tracking contributions from OpenJDK developers who do not have push rights to the JDK 6 and 7 forests. The next phase will expand the system to track most if not all of the OpenJDK projects under development. The longer story is now available on the OpenJDK website."


In today's Weblogs, Jim Driscoll cleans up his component logic in JSF 2.0: A Component's Controller. "After my last blog post on composite components, Ed Burns, the spec lead, pointed out a better way to do things, by using a controller for the component. Here's a short explanation of what to do to make that work."

Kohsuke Kawaguchi explains the process of Writing a Unix daemon in Java with Akuma. "Writing a proper Unix daemon in Java used to be very difficult, due to the lack of access to the OS capabilities from Java. So I wrote a library to overcome this problem."

Finally, in Pack and Deliver Synth Based Look And Feel, Xuan Yun will "Introduce how to pack Synth based look and feel as a JAR file. "


This week's Spotlight is on the OpenSSO community's newly-announced conference, OpenSSO Community Day, to be held March 17 at the NYU Kimmel Center in New York, the day before CommunityOne East. "Hosted by New York University and sponsored by Sun Microsystems, this is an opportunity for OpenSSO contributors, deployers and users to come together in an informal 'unconference' setting. Being an unconference, the only rigid item on the agenda is to decide at 9am on the sessions for the rest of the day. You can show up and talk about any OpenSSO-related topic you like. [...] All are welcome, attendance is free, and continental breakfast plus lunch will be provided."


In today's Forums, tck asks about JOGL renderer and getPreferredConfiguration() delays. "I've been experimenting with Java3D 1.5.2 and the jogl renderer (JOGL 1.1.1). Things look great with the exception of a significant pause with the *first* call to SimpleUniverse.getPreferredConfiguation(). I am seeing delays on the order of 15+ seconds for the call to return. This delay is not observed with the d3d or ogl renderers (at least of the same magnitude). [...] Is there a way to minimized this delay?"

Dobes Vandermeer is considering different strategies for Using JMS. "Is it expensive to create a JMS connection, session, and sender each time I send a message, or should I do some extra work to make these reusable? I was trying to reuse them before but I ran into problems - for example, changing the parameters of the connection factory from the admin interface invalidated the connection objects I had."

drdth continues the contentious thread
Re: Do you guys agree that J2ME is dying? with a complaint about ME fragmentation. "IMHO the biggest thread to JME isn't Apple but Sun itself. If they had used their efforts to govern towards a consistent JVM and deployment process across vendors, instead of constructing a painful code signature nightmare for developers, then the open source community could enter the JME market and applications would run closer to 'everywhere'."

Sarah kho asks
what happens when glassfish starts in profile mode? "Can someone please let me know what happens when we start the glassfish in profile mode, is there some asadmin command to start the application server in profile mode or it is just netbeans ide that can do this?"


Current and upcoming Java
Events
:

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
site.


Archives and Subscriptions: This blog is delivered weekdays as
the Java
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 href="http://today.java.net/today/archive/">java.net Archive.

Calling for a Swing cleanup

Comments

@varan You are right in that Swing has a fairly high technical tresh hold, partly because of its flexibility. Basically your structured containers are nothing more than a predefined containers+layout, but for starters it is easier to think in structured containers (although the step to layouts is just a very small one); horizontal container here, vertical there and the whole shown in a window . One of my suggestions for Swing 2.0 was to more hide the implementation details from the users... Take JTable and the TableModel. Great idea, and very confusing for starters at the same time. Starters just want a Table and put stuff in it and fetch from it. But there are many more in this category; CalendarTextField, NumberTextfield, etc, etc. Starters just want a component, not a formatted text field and set formatters... Way too complex.

The basic concept of a layout manager is flawed. There should just be structured containers such as rows, grids etc. That behind the scenes a Layout Manager may be used within the context of swing is a irrelevant. A typical programmer just wants a container in which he wants to line up the components in a particular way. Layout Managers come with too much baggage for such simple tasks.

yes, Swing should be cleaned up and brought kicking and screaming into the century of the fruitbat.

Vector? Hashtable? Come on... We're programming to interfaces these days, not implementation classes. Why weren't all those references updated to Lists and Maps with the introduction of the Collections API a decade ago?

I fully agree that cleaning up the backend of the framework before even thinking of adding more blingbling to the frontend is the only way to go. Most applications written in Java are business applications as is, and for those fancy animated buttons and transparent windows aren't as important as the hobbyists who push for them want to make you believe they are.

If such things are added (and possibly other, more useful things) before the current codebase is brought up to date it's only going to get harder to modernise it as it will require more work (thus more money, more manhours, more risk of failure).

@varan: I tend to disagree - layout managers are useful. There may be too many, but the ones in Swing by default are largely useful, and if combined with migLayout, you have all the layout managers you need....

It is interesting that in the very post that you link to a blog that suggests improvements to Swing, you chose to announce yet another layout manager project which, on the face of it, seems to be a step backward. As I point out on Giles' blog, layout managers should be completely dispensed with, and replaced by 'structured' containers so that the user just has to worry about whether to put components in rows, columns or grids, etc.

Thanks for the link to my blog regarding Swing 2.0. I am fully pushing for Sun to take a stance on the matter, and based on my discussions with a number of Swing-team (and higher) staff members at Sun, I am lead to believe that a response is due to come shortly - most probably from Danny Coward on his 'The Planetarium' blog. The Swing 2.0 community is waiting very patiently :-) You're correct, when Swing come out I would probably have been 13 or 14, and I certainly wasn't using it back then. I have been a heavy user of Swing since about 2003, so I know much about it, but I would say that whilst I understand the Swing legacy, I don't much support it :-) I would love to see a Swing 2.0 project that takes Swing forward. If you look at the number of comments on my blog, there is a community desire for an improved Swing-like API. JavaFX isn't doing it for these people, and likely won't anytime soon. I have been told to take up a leadership role on Swing 2.0, but without Sun backing I would say Swing 2.0 would be a very non-trivial job given I need to earn a living. So, I'll wait and see what Sun has to say. Hoping for the best! I'll make a blog post as soon as I hear anything, announcing the future of Swing 2.0. Cheers, Jonathan Giles http://www.JoGiles.co.nz