Forcing swing gui to be drawn

M

moulio

Hey, right now I have a program that analyzes an EKG when a button is
clicked. I want to pop up a progress bar in a new frame to show how far
it is, but I'm having problems. I can create the frame, and it will
appear, but it won't draw the progress bar until it is done executing
all of the other commands.

I ahve tried opening the frame with a separate thread, but it resulted
in the same problem. I guess there must be some draw queue that is on a
low priority, but I really have no idea why it isn't working.

Any help would be great... I show this at a science fair in 2 days.
Thanks!

-Thomas
 
R

Ryan

Hey, right now I have a program that analyzes an EKG when a button is
clicked. I want to pop up a progress bar in a new frame to show how far
it is, but I'm having problems. I can create the frame, and it will
appear, but it won't draw the progress bar until it is done executing
all of the other commands.

I ahve tried opening the frame with a separate thread, but it resulted
in the same problem. I guess there must be some draw queue that is on a
low priority, but I really have no idea why it isn't working.

Any help would be great... I show this at a science fair in 2 days.
Thanks!

-Thomas

Take a look at this site
(http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html),
it is a progress bar tutorial with demos and source code.
 
L

Larry Barowski

moulio said:
Hey, right now I have a program that analyzes an EKG when a button is
clicked. I want to pop up a progress bar in a new frame to show how far
it is, but I'm having problems. I can create the frame, and it will
appear, but it won't draw the progress bar until it is done executing
all of the other commands.

I ahve tried opening the frame with a separate thread, but it resulted
in the same problem. I guess there must be some draw queue that is on a
low priority, but I really have no idea why it isn't working.

You must do your analysis in a separate thread. Be sure
not to do any gui operations outside the EDT - to update
the progress bar from the other thread, use
SwingUtilities.invokeLater().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top