Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Thread - wait() and notify()

Status
Not open for further replies.

russland

Programmer
Jan 9, 2003
315
CH
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());
}
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top