I searched the forum before here and found some implementation examples of a progress bar on command line. Now I have an additional question. I am using the following implementation example:
public void print_progress(int percent){
StringBuilder bar = new StringBuilder(category + ": [");
for(int i = 0; i < 50; i++){
if( i < (percent/2)){
bar.append("=");
}else if( i == (percent/2)){
bar.append(">");
}else{
bar.append(" ");
}
}
bar.append("] " + percent + "% ");
System.out.print("\r" + bar.toString());
}
But I want to use it in three threads, running at the same time, want to show the progress for every thread in a bar like that on the command line. Right now whenever a thread calls the print_progress() method it overwrites the one of the thread before.
Can someone tell if that is possible, and if yes, how?
Thanks very much in advance.