I have 2 JFrame: NewJFrame
and NewJFrame1
. NewJFrame
has a progress bar and a button. the button is used to call up NewJFrame1
. When the button is clicked it should trigger the progress bar to run until NewJFrame1
pop up. However, how do I make use of the swing worker and let the progress to run until NewJFrame1
actually competely loaded all of its component?
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
SwingUtilities.invokeLater(new Runnable() {
int i = 0;
public void run() {
jProgressBar1.setValue(i++);
new NewJFrame1().setVisible(true);
}
});
}