jProgressbar e Jtextfield not updating
Hi! i am creating a little application: a JFrame. It reads from N xml files tags and write them in a DB. I'd like to add a JProgressBar and a jtextfield showing the progress status, so I added them and inside a "for" cycle I update them:
fileCorrente=0;
fileTotali = N;
// nrFiles = new JTextField()
//jProgressBar1 = new JProgressBar()
jProgressBar1.setMinimum(fileCorrente);
jProgressBar1.setMaximum(fileTotali);
jProgressBar1.setValue(fileCorrente);
jProgressBar1.setStringPainted(true);
for (int i=0; i < fileTotali;i++){
nrFiles.setText(fileCorrente+" / "+fileTotali);
importaFile(lstFiles[i]);//THE TASK
fileCorrente++;
jProgressBar1.setValue(fileCorrente);
nrFiles.setText(fileCorrente+" / "+fileTotali);
}
jProgressBar1.setValue(fileCorrente);
nrFiles.setText(fileCorrente+" / "+fileTotali);
It doesn't work! it only show 0/5 files --> 5/5 files
and the progressBar 0% --> 100&
why don't they get updated during the execution of "FOR"?
thanks in advance, Giacomo

