Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

So is there some sort of "new Swing" in Java 1.5?

 
Sandy Shaffer
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm brand new to Java and I'm justr trying to figure out where to start for doing GUIs. From what I've read, if you care anything about having a responsive GUI, you need to avoid Swing. And in my own experience, I've seen the annoying delays that Swing GUIs exhibit - albeit short, but even a half-second delay every time you click a button is annoying.

But I thought I had heard that 1.5 was going to have a new, revamped version of Swing that somehow eliminated the delays of old. Did anything ever really happen with this?

All I really want is a GUI system that SEEMs as snappy as native Windows apps.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Swing is slow" is a common misconception. See this for a real good presentation on threading issues associated with Swing applications.

The only enhancement that 1.5 brought to swing as far as performance was the Graphics API utalizing the Opengl pipeline which has to be turned on with via a switch when running java.exe. See here for more details.
[ February 02, 2005: Message edited by: Gregg Bolinger ]
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swing is actually a great responsive GUI framework. The problem is what processing you do, and in what thread you do it, when an action is taken such as clicking a button. Two fairly easy things to look at for responsive swing apps are SwingWorker and foxtrot. There are others, but these are the two I've found most useful.

You may also want to check out 'Professional Swing: creating polished apps' and 'Professional Swing: Threading'.

Now if you really feel the need to get away from Swing the most popular alternative is probably SWT. (I just hope this thread doesn't turn into a big Swing vs SWT battle).
 
K Riaz
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Swing takes too long to render. Look at OpenOffice from Sun, it has an absolutely rubbish GUI (15-20 seconds to open a .doc). Now look at the Eclipse IDe, which is made from SWT. Very fast rendering.
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kashif Riaz:
Swing takes too long to render. Look at OpenOffice from Sun, it has an absolutely rubbish GUI (15-20 seconds to open a .doc). Now look at the Eclipse IDe, which is made from SWT. Very fast rendering.


I would not equate opening a .doc file with Swing rendering performance. That is just ridiculous. I've seen several 'rendering benchmarks' between Swing and SWT none of which show any dramatic difference (depending on the JVM, OS, ect... sometimes Swing is faster, sometimes SWT is faster). I won't get into the OOo GUI as I'm not familiar with it's inner workings (although I use it quite often and have never thought of it as a bad unresponsive GUI).

Swing and SWT have different approaches to rendering and event handling. IMHO they are both good frameworks with different strengths and weaknesses. I would probably say that if you are looking at a primarily Windows app and you want 'better native look n' feel' you probably want to go with SWT, may even be faster. If you want to have more flexability in you components and don't mind a little lose in fidelity, or maybe even want your own look n' feel (some of the best apps I use don't conform to standard OS looks) then you probably want to use Swing. Generally I tend to use Swing because I'm more familiar with it.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kashif Riaz:
Swing takes too long to render. Look at OpenOffice from Sun, it has an absolutely rubbish GUI (15-20 seconds to open a .doc). Now look at the Eclipse IDe, which is made from SWT. Very fast rendering.


OpenOffice doesn't use Swing for it's GUI. http://www.openoffice.org/FAQs/build_faq.html#source Do you have other information?
[ February 04, 2005: Message edited by: Gregg Bolinger ]
 
Alan Moore
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gregg, thanks for the reminder about the OpenGL switch. I recently switched to using anti-aliased fonts in my editor, but scrolling became a little jerky as a result. Turning on OpenGL fixed that, though, and now it's both smooth and, um, smooth!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!