Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Frame/Panel question

 
Frank McKitrick
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Folks,
Please help.
In my java class - full listing below, basically I want a messsge 'Retreiving Users' to appear while the process which does this runs, so I want tempPanel() to appear in my frame while initUserUtility() runs but I only get any frame update at the end of the method.

If it helps I'd like some general guidence or an example of a class which has the frame being updated e.g. panels being added/replaced during a sequential process so first 'INITIAL DISPLAY', then later 'UPDATE MESSAGE' the later 'NEXT MESSAGE' then at the end of the process 'FINAL DISPLAY'.

- see this bit:-











 
Paul Clapham
Sheriff
Posts: 21126
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank McKitrick wrote:If it helps I'd like some general guidence or an example of a class which has the frame being updated e.g. panels being added/replaced during a sequential process so first 'INITIAL DISPLAY', then later 'UPDATE MESSAGE' the later 'NEXT MESSAGE' then at the end of the process 'FINAL DISPLAY'.


Wow, that's a lot of code! Fortunately this question can stand on its own without the code example. And in answer to it, let me refer you to the Swing concurrency tutorial. Basically you have to run your long-running code in a separate thread, and have that thread call SwingUtilities.invokeLater() to display the progress indications -- but read the tutorial for a better explanation.

Or perhaps a progress bar or progress monitor would work? Here's a tutorial about those: How to Use Progress Bars.

(For future reference: a short, simple, compilable piece of code is more useful for people trying to answer questions than your whole magnum opus. See SSCCE for more about that.)
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And UseCodeTags when posting code.
 
Frank McKitrick
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, folks and point taken about code tags (I wondered how you did that - it's my first post on the site).
I'll check out those tutotials.
Cheers,
Frank.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49403
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You click the code button and you get tags like this [code=java][/code] and you put your code (correctly indented) inside them. I have edited your post, so you can see how much better it would have been. I had to put new line in because some lines would have gone over the edge of some people’s screens.

And welcome to the Ranch
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic