K
karpthomas
Hi,
I want to update a component several times.
When the user clicks a button, another component
- e.g. a JProgressBar, but it seems that this doesn't matter -
should be updated several times.
The code looks like following:
private void goButtonActionPerformed(java.awt.event.ActionEvent evt) {
for (int i = 0; i <= 10; i++) {
try {
Thread.sleep(300);
progressBar.setValue(i);
} catch (InterruptedException e) {
// do something
}
}
}
The problem is, that the component seems to be repainted only, when
the method
is finished.
What am I doing wrong?
Regards, Thomas
I want to update a component several times.
When the user clicks a button, another component
- e.g. a JProgressBar, but it seems that this doesn't matter -
should be updated several times.
The code looks like following:
private void goButtonActionPerformed(java.awt.event.ActionEvent evt) {
for (int i = 0; i <= 10; i++) {
try {
Thread.sleep(300);
progressBar.setValue(i);
} catch (InterruptedException e) {
// do something
}
}
}
The problem is, that the component seems to be repainted only, when
the method
is finished.
What am I doing wrong?
Regards, Thomas