Forcing swing gui to be drawn  
Author Message
moulio





PostPosted: 2005-5-19 8:41:00 Top

java-programmer, Forcing swing gui to be drawn 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

 
Ryan





PostPosted: 2005-5-19 9:58:00 Top

java-programmer >> Forcing swing gui to be drawn On 2005-05-18 20:40:48 -0400, "moulio" <email***@***.com> 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.
>
> 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.

 
Larry Barowski





PostPosted: 2005-5-19 10:44:00 Top

java-programmer >> Forcing swing gui to be drawn
"moulio" <email***@***.com> wrote in message
news:email***@***.com...
> 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().


 
 
moulio





PostPosted: 2005-5-20 1:02:00 Top

java-programmer >> Forcing swing gui to be drawn Having a separate thread worked great. Thanks for the help!!!
-Thomas