omegajb24
2009-07-21 11:31:37 UTC
The main loop:
System.out.print("Would You Like To Throw Darts (Y or N)? ");
String x = in.next();
int counter = 1;
while (!x.equalsIgnoreCase("N"))
{
panel.changeArrows();
counter++;
System.out.printf("Score is %d.%n", panel.scoring());
System.out.print("Another Round (Y or N)? ");
x = in.next();
}
System.exit(0);
changeArrow method it calls:
public void changeArrows()
{
showArrows = true;
repaint();
scoring();
}
The program is set up so that the arrows aren't drawn until the user declares they want to play. The panel is then repainted with the arrows on it. Everything works fine except the arrow locations never change. The arrows are objects created out of a separate arrow class. The randomization takes place in that arrow class. What would be a good way to get the arrows to randomize and repaint on the panel each time the user wants to play?