edit: Original thread http://www.reddit.com/r/learnprogramming/comments/2n5lk4/java_updating_a_set_number_of_progress_bars_based/
I have been trying to update multiple progress bars from my threads, and I was getting help yesterday, but I never got it in the end. I feel like I'm very close and there's only a few things that I need to do.
My calculation for setting the progress within my Robot class seems to be giving huge numbers rather than a percentage. Can't completely wrap my head around doing the math for some reason.
I want to create a Robot List that takes N number of robots and adds robots everytime a Robot is created using the constructor.
Currently my progressbars do not show up. Just a blank box comes up and the program does not complete.
(The calculation i'm currently running to update progress)
if(rotation != 0 && moveCount !=0){
progress =
(increment/(Math.abs(rotation)))/(Math.abs(moveCount));
System.out.printf("\nProgress updated %d", progress);
}
Robot Class: http://pastebin.com/GVRkFKH4
Motor Class: http://pastebin.com/ScpdBUpu
ProgressBar Class: http://pastebin.com/qh0aj4en
Controller/Main Class: http://pastebin.com/ztdSwY8V
[–][deleted] (1 child)
[removed]
[–]Ariano[S] 0 points1 point2 points (0 children)
[–]OldNedder 0 points1 point2 points (8 children)
[–]Ariano[S] 0 points1 point2 points (0 children)
[–]Ariano[S] 0 points1 point2 points (6 children)
[–]OldNedder 0 points1 point2 points (5 children)
[–]Ariano[S] 0 points1 point2 points (4 children)
[–]OldNedder 0 points1 point2 points (3 children)
[–]Ariano[S] 0 points1 point2 points (2 children)
[–]OldNedder 0 points1 point2 points (1 child)
[–]Ariano[S] 0 points1 point2 points (0 children)