eu crei um progressbar tranquilo , com esse codigo
public class MeuProgressBar extends JPanel {
JProgressBar pbar;
JFrame frame = new JFrame();
static final int MY_MINIMUM = 0;
static final int MY_MAXIMUM = 100;
public MeuProgressBar() {
pbar = new JProgressBar();
pbar.setMinimum(MY_MINIMUM);
pbar.setMaximum(MY_MAXIMUM);
pbar.setStringPainted(true);
pbar.setString(“aqui”);
this.add(pbar);
}//public…
public void atualizar(int novovalor) {
pbar.setValue(novovalor);
}
public void criarProgress(String msg){
final SwingProgressBarExample it = new SwingProgressBarExample();
JFrame frame = new JFrame(msg);
frame.setTitle(msg);
frame.setDefaultCloseOperation(frame.DISPOSE_ON_CLOSE);
frame.setAlwaysOnTop(true);
frame.setLocationRelativeTo(null);
frame.setSize(100,20);
frame.setContentPane(it);
frame.pack();
frame.setVisible(true);
// JDialog dlg = new JDialog(frame, msg, true);
// JDialog dlg = new JDialog();
// dlg.setModal(true);
// dlg.setTitle(msg);
// dlg.setSize(100,20);
// dlg.setContentPane(it);
// dlg.pack();
// dlg.setVisible(true);
//
for (int i = MY_MINIMUM; i <= MY_MAXIMUM; i++) {
final int percent = i;
System.out.println(i);
try {
it.updateBar(percent);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
it.updateBar(percent);
}
});
Thread.sleep(10);
} catch (InterruptedException e) {
}
}
}//lkj
mas eu criei UM jframe com a intenção é q q quando eu clicar em SALVAR…
ele chama a classe MeuProgressBar e cria o JProgressBar, mas o problema que quando eu clico em salvar
ele chama o JpROGRESSBAR , mas NAO fica desenhando passo a passo na tela.
mas quando eu executo a classe MeuProgressBar separadamente, ele excecuta blz
podem me ajudar