jprogressbar visible and working on button click
Posted
by
Jisson
on Stack Overflow
See other posts from Stack Overflow
or by Jisson
Published on 2011-01-14T05:48:15Z
Indexed on
2011/01/14
5:53 UTC
Read the original article
Hit count: 229
swing
public NewJDialog(java.awt.Frame parent, boolean modal) { super(parent, modal); initComponents(); jProgressBar1.setVisible(false);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
jButton1.setEnabled(false);
jProgressBar1.setVisible(true);
repaint();
for(int i=0;i<=100;i+=5){
jProgressBar1.setValue(i);
// jProgressBar1.setIndeterminate(false);
try{
jProgressBar1.paintImmediately(0, 0, 100, 100);//0, 1, 100, 10
Thread.sleep(100);
jProgressBar1.setStringPainted(true);
}catch(Exception e){}
}
I use above code for using a Jprogressbar in a JDialog,If I use this I can see a progressbar aftercompleting its process(100 %) and also I want to hide progressbar upto buttonclick.Can any one help me?
© Stack Overflow or respective owner