This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Frame/Panel question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Frame/Panel question" Watch "Frame/Panel question" New topic
Author

Frame/Panel question

Frank McKitrick
Greenhorn

Joined: Jul 18, 2012
Posts: 2
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Oct 16, 2003
Posts: 1076
    
  10

And UseCodeTags when posting code.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Frank McKitrick
Greenhorn

Joined: Jul 18, 2012
Posts: 2
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

Joined: Oct 13, 2005
Posts: 38057
    
  22
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
 
Don't get me started about those stupid light bulbs.
 
subject: Frame/Panel question
 
Similar Threads
Duplicate items in JCombobox
Crypto Challenge Instructions
GridBagLayout Problem
linking between applet pages
Editable JComboBox that must accept only alphabets