Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing Guidelines  RSS feed

 
Dave Brown
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Does anyone know any good resources to show good tatics to use when developing swing app's for best performance.

I've been working on my first app for a few weeks now, and love the way its going but am starting to get a little concerned over the performance. For instance when one of my frame is coming up it hits the validate() call and theres a couple of seconds noticable delay. I'm not sure if its the table listeners initialising or what thats taking the time, or even maybe my form is getting too complex with too many components.

I've been using tab panels with tables on each panel and textfields and perhaps its just taking too long for it all to draw.

When the app cranks up and i've been into each screen then its fast at going through them, but the first time thats where its slow.

I dont really understand about threading too well, whether it would be wise to do some kind of initialisation using threads.

Hopefully I'll find all this out if theres a good resource out there, So anyone found any good URLS relating to swing app performance ?

Thanks,
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at http://java.sun.com/docs/books/performance/1st_edition/html/JPTOC.fm.html and scroll about half way down the page to where they talk about swing apps. I was really impressed at the performance improvements that have happened since starting to implement the things listed on this site. Even bought the book for reference.

Cheers,
Rachel
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first thing to do is to run your app through a profiler and find out why your app is taking along time to initialise. I belive JProfiler have a trial license you can use for 10 days or if using the Netbeans IDE you can use JFluid for free.
Let us know what you find. The most common problem is doing non-gui initialisation on the gui thread.
cheers,
D.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd say that the majority of Swing performance issues are more likely do to misunderstanding how to use threads appropriately in a Swing application. Any GUI application is going to have moments when it appears to run slow. This is usually because there is a long running task but you have designed the app so that the GUI is unresponsive to the user and/or nothing is notifying the user of what is going on.

If I were you I'd take a look at Desktop Java Live and specifically Chapter 5 on Swing Threading (which just happens to be the sample chapter).

Understanding how to use threads in Swing and how the EDT works will take care of the majority of your performance issues that appear to be Swing related.
[ July 22, 2005: Message edited by: Gregg Bolinger ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!