This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
What options are available for building GUIs other than Swing?
I love Java, but my department is finding that our Swing development is taking too long. It is easy to prototype a screen in Swing, but Swing is really quirky for building complex apps. Understanding the subtleties of the listeners and events in Swing takes time. The last 20% of our screen development is taking a lot of time.
This line of code is from a program I worked on today:
I agree with you on the pitfalls of using Swing. I haven't used VB or SWT myself. I know some people who use VB regularly, and they complain about what a pain it is, but they haven't used Swing, so I don't have a direct comparison.
I found the following article comparing Swing and SWT informative:
It looks like there's not clear better choice, though - each has its advantages and disadvantages. For example, having an explicit event loop sounds good to me - I think Swing's implicit event loop can cause difficulties - but on the other hand, having to explicitly release resources sounds like a pain to anyone who has gotten used to Java's garbage collection.
I wish I could get my hands on Swing with a team of three or four programmers and technical writers for a year.
In the Java world, SWT is probably the alternative. If you don't care about what language, rather than specifiying VB I would say Windows Forms is another alternative. Windows Forms can be used in all the .NET languages.
I don't think the problem is with Swing. I think the problem is Swing needs a higher level of abstraction. I think Swing is probably the most robust, powerful, customizable GUI toolkit on the market. SWT has JFace. Swing needs a SwingSet.
Seriously, GridBagLayout is crap - fortunately there are alternatives. Hell, you can even write your own layout managers!
Joined: Mar 04, 2004
Actually, I've used GridBagLayout with success, though each time I have to go through a day of making all the same mistakes before figuring out again how it works.
It interacts poorly with certain components, notably JTextField. People tend to blame this on GridBagLayout, but I think it actually has more to do with the nonstandard way JTextField seems to deal with minimum/preferred/maximum sizes.
Naturally, none of this seems to be documented anywhere other than funny web videos....