File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Swing alternatives? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Swing alternatives?" Watch "Swing alternatives?" New topic
Author

Swing alternatives?

Rick Portugal
Ranch Hand

Joined: Dec 17, 2002
Posts: 243
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:

jTable.getColumnModel().getColumn(0).setCellEditor(new DefaultCellEditor(new JTextField()));

It turns out that the cell editor that Swing uses by default works a little differently than the DefaultCellEditor mentioned above. There are a lot of subtle details that you need to be aware of.

What are the other options? What are the pros and cons? Are there any studies that compare development time in Swing vs. other technologies?

Has anybody here used VB or SWT for GUIs in real-world applications? What are your opinions about this?


IBM 286, SCJP, SCWCD, EIEIO
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    2
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:

http://www.fawcette.com/javapro/2002_12/magazine/columns/proshop/

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.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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.


GenRocket - Experts at Building Test Data
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    2
Powerful and customizable maybe. Robust?

http://madbean.com/blog/2004/17/totallygridbag.html
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6



That was funny!
Daniel Mayer
Ranch Hand

Joined: Sep 09, 2004
Posts: 103
Originally posted by Gregg Bolinger:


That was funny!


Yeah, in a kinda tragic way...

Seriously, GridBagLayout is crap - fortunately there are alternatives. Hell, you can even write your own layout managers!
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    2
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....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Swing alternatives?