Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFrame.setVisible very slow in debugger

Malcolm Storey
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Am developing a multi-window app using Swing in Eclipse and it's suddenly started running very slowly, especially in the debugger. It takes two minutes (I timed it - it seems a lot longer when you're waiting!) to open the three initial JFrame windows. Stepping thru with the debugger it seems to spend 10 or 20 seconds in setVisible - presumably it's doing the layout?

The windows aren't that complicated. The content pane use a BorderLayout to lay out the component panels, which themselves have various layout managers. Are there any general principles that one should adhere to? eg not nesting more than n panels deep, or not nesting a panel with layout x in one with layout y?

Obviously each window is built in a RunLater on the dispatch thread - the code is liberally peppered with: Would it help if I split the GUI building into several chained RunLaters?

Or is two minutes to load quite normal?

Once the program starts running in the debugger there's a liveness issue, but it seems OK when running normally.

Be grateful for any pointers or pitfalls to avoid. Many thanks for your thoughts.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic