Problem with Progress Bar
in
Programming Questions
•
9 months ago
Hi guys!
I am using Processing (in particular Processing in Eclipse), but when I perform a time consuming task (for example loading many files), I don't know how to inform the user of the progress of the task. Let's suppose this simplified code: When a user clicks, a new loading is performed, FileLoader is a class I created to perform my file loading task, the problem is that, during the loading, the draw gets stuck, I would like to have something like: text("The progress is "+loader.getProgress(),width/2,height/2), I think this will involve threads or the Java class ProgressMonitor but I have never worked on this stuff, could someone please help me with a sample code? Thank you!
I am using Processing (in particular Processing in Eclipse), but when I perform a time consuming task (for example loading many files), I don't know how to inform the user of the progress of the task. Let's suppose this simplified code: When a user clicks, a new loading is performed, FileLoader is a class I created to perform my file loading task, the problem is that, during the loading, the draw gets stuck, I would like to have something like: text("The progress is "+loader.getProgress(),width/2,height/2), I think this will involve threads or the Java class ProgressMonitor but I have never worked on this stuff, could someone please help me with a sample code? Thank you!
setup(){
}
draw(){
}
mousePressed(){
FileLoader loader = new FileLoader();
loader.performLoad(); //this method perform a loop of 3000 iterations, each one loads a file
}
1