I need to create something like a progress bar with java that appear on the output terminal of Netbeans. My idea is to have on the output :
loading *
with the asterisk that seems like something that spin by using the sequence of - \ | / -. I have thought to this code :
public void progressBar(int min){ //minute of spin
long time=System.currentTimeMillis();
long check_time;
int i=1;
while(check_time-time<min){
switch(i){
case 1:
System.out.println("loading -");
i++;
case 2:
System.out.println("loading \");
i++;
case 3:
System.out.println("loading |");
i++;
case 4:
System.out.println("loading /");
i=1;
}
check_time=System.currentTimeMillis();
}
}
but the output of this code is :
loading -
loading \
loading |
loading /
// and so on
I would that "loading" isn't written continuously and the following symbol appear in sequence to seems like a wheel that rotate.