|
-
Dec 14th, 2006, 02:13 AM
#1
Thread Starter
Frenzied Member
JProgressBar
I have a JFrame with a button which connects to a SQL server. In the try-catch code, i have progressBar.setValue(*value*); methods. When the code is executed and it is connecting to the server, the progress bar doesn't update on the form.
I read that this is due to the fact that the UI doesn't update the form until after the thread is done processing.
Is there any type of Java equilvalent code to the VB.net code Application.DoEvents() (or VB6 DoEvents function)?
-
Dec 14th, 2006, 05:45 AM
#2
Re: JProgressBar
No DoEvents. In Java you're expected to use threads for long operations.
However, there is a method to force a redraw of the windows immediately. I forgot its name.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 14th, 2006, 12:11 PM
#3
Thread Starter
Frenzied Member
Re: JProgressBar
its not JProgressBar1.UpdateUI(); is it? I tried that and it didnt work...
-
Dec 14th, 2006, 12:27 PM
#4
Re: JProgressBar
No, I'm talking about repaint().
Mostly, though, if you really have a long task, you should just spawn a thread for it.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|