Better Java Swing DevelopmentApr 17, 2008 · 3 minute read · Comments
It has been a while since I have looked at the different options for building GUIs in Java. I like the approach taken by Eclipse, they provide not only GUI components, but a complete GUI application framework. Several years ago, I have stolen ideas from it (how they manage plugins) and applied it for Swing applications. This worked out quite well. The Netbeans platform now offers a more interesting alternative if you have to do Swing. The major drawback when compared to Eclipse, is that since the beginning Eclipse was all about making a platform, while Netbeans copied that idea only relatively recently and is less active about making it so. IBM uses Eclipse foundations for many of their products successfully.
Unfortunately on many projects, a Swing application is already there and all you have to do is add more screens, more forms. What I am trying to see here, is what could help Swing development is those cases.
JGoodies is old now, but can be quite useful in creating nice looking forms quickly. It is basically all around a layout better tailored to forms that the can do everything GridBagLayout.
It can help but it does not make a significant difference vs good practices with the GridBagLayout.
Jidesoft provides much more than JGoodies, but is not free (except the Jide Common Layer). I have used it in the past and found their API quite clean and easy to use. They offer more elaborated Swing components that should be part of the JDK. They started to go to the platform area only recently with their Jide Desktop Application Framework, which is not free either. I am not sure I would base an application around an unfree framework.
It is a recent BSD licensed project based on top of Swix. It is basically MVC for Swix, with command binding in XML. I need to look more into it, it seems to provide an "application framework" as well where you have to launch your app through a SwixAt class (which IMHO sucks). I hope it is not a requirement and that only parts of it can be used and integrated into an existing application. I will hopefully have time to try it more concretely and will blog about it. In any cases it looks interesting.
An Apache licensed project, it seems like a decently used way of laying out swing components in XML, inspired by XUL. It might just be enough. Or is it just too similar to Java code translated to XML? I need to investigate this more.
JavaFX is probably the serious alternative to SwiXml. I like the idea of a better grammar to lay out and assemble components instead of using XML. Unfortunately it seems a bit invasive to start using for a part only of an application
I took a quick look at Swing Application Framework (JDNC2 redone once again). While it has interesting use of annotations, it seems very far from what Eclipse offers. And I don't feel like it will improve working with Swing a lot. I think except JavaFx, Sun seriously fucked around during many years with Swing. IBM has been much more focused and effective.