Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Swing alternatives?

 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
blacksmith
Posts: 1332
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Warren Dew
blacksmith
Posts: 1332
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Powerful and customizable maybe. Robust?

http://madbean.com/blog/2004/17/totallygridbag.html
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Warren Dew:
http://madbean.com/blog/2004/17/totallygridbag.html



That was funny!
 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 1332
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....
 
Do not threaten THIS beaver! Not even with this tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!