I'm strugling to update the progressbar. the image treatment is top priority for the cpu. therefore the Progressbar doesn't show up. does anyone know how to use wait() and notify() together with synchronized?
code snippet
--------------------------------------------------
jProgressBar1.setStringPainted(true);
File dir = new File("F:\\Documents and Settings\\rogerrabit\\My Documents\\My Pictures");
FilenameFilter filter = new JPGFilter();
File dirList[] = dir.listFiles(filter);
if(dir.isDirectory()){
for(int i=0; i<dirList.length; i++){
jProgressBar1.setValue( (jProgressBar1.getValue()+1) *100 / dirList.length );
ImageTreater it = new ImageTreater();
synchronized(it){
it.notify();
it.wait(50);
it.init(dirList.getAbsolutePath());
}
}
}
code snippet
--------------------------------------------------
jProgressBar1.setStringPainted(true);
File dir = new File("F:\\Documents and Settings\\rogerrabit\\My Documents\\My Pictures");
FilenameFilter filter = new JPGFilter();
File dirList[] = dir.listFiles(filter);
if(dir.isDirectory()){
for(int i=0; i<dirList.length; i++){
jProgressBar1.setValue( (jProgressBar1.getValue()+1) *100 / dirList.length );
ImageTreater it = new ImageTreater();
synchronized(it){
it.notify();
it.wait(50);
it.init(dirList.getAbsolutePath());
}
}
}