Board index » jbuilder » JProgressBar

JProgressBar


2003-09-16 04:27:01 AM
jbuilder15
Hello,
I used a JProgressBar inside a while loop to show user about the progress of
a dabatase update but it doesn´t update the bar. My code is :
JProgressBar jprgbar = new JProgressBar();
jprgbar.setEnabled(true);
jprgbar.setIndeterminate(false);
jprgbar.setMinimum(0);
jprgbar.setMaximum( linhasDBF );
jprgbar.setValue(jprgbarImporta.getMinimum());
jprgbar.setStringPainted(true);
while (condition) {
<update database code>
jprgbar.setValue(dmClipper.qryClientesDBF.getRow());
}
I use the getRow() method of a QueryDataSet to update the JProgressBar, as
you can see.
The only situation that I can see the bar being updated is when a
JOptionPane is shown by an error message call.
I saw the code used at the Sun Tutorial Sample and the code is like this I
used above.
Does anybody can help me, please ?
Thanks.
--
Alexandre Boaventura
Programador - GZ sistemas
XXXX@XXXXX.COM
www.gzsistemas.com.br
 
 

Re:JProgressBar

Alexandre Boaventura wrote:
Quote
Hello,

I used a JProgressBar inside a while loop to show user about the progress of
a dabatase update but it doesn´t update the bar. My code is :

JProgressBar jprgbar = new JProgressBar();
jprgbar.setEnabled(true);
jprgbar.setIndeterminate(false);
jprgbar.setMinimum(0);
jprgbar.setMaximum( linhasDBF );
jprgbar.setValue(jprgbarImporta.getMinimum());
jprgbar.setStringPainted(true);

while (condition) {

<update database code>

jprgbar.setValue(dmClipper.qryClientesDBF.getRow());
}


I use the getRow() method of a QueryDataSet to update the JProgressBar, as
you can see.
The only situation that I can see the bar being updated is when a
JOptionPane is shown by an error message call.


I saw the code used at the Sun Tutorial Sample and the code is like this I
used above.
Does anybody can help me, please ?

Thanks.



You need to investigate the usage of SwingUtilities.invokeLater. You
can find references in the Swing tutorial on Sun's website.
--
Regards,
Lori Olson (TeamB)
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
www.google.ca/advanced_group_search
Other Newsgroup Searches:
www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
www.visi.com/~gyles19/fom-serve/cache/1.html