Hi i want to know how to call the paint method...
I am a novice programmer and am really just experimenting with things like paint.
The program i am trying to make is the game where there are 3 rungs and the aim of the game is to move different sized disks from the left/right rung to the right/left rung.
here is my code(no where near finished give me a break):
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int amount = 0;
// get the amount of rectangles to draw to represent disks
while (amount <= 1 && amount >= 5) {
System.out.print("Please enter amount of discs to use(less than 7 more than one).");
amount = scan.nextInt();
}
}
public void paint(Graphics g) {
// draw a certain amount of rectangles in ascending order
if (amount <= 1 && amount >= 5) {
for (int i = 0; i < amount; i++) {
g.fillRect(220 - (20 * i), 200 + (10 * i), 100 - (20 * i), 20);
}
}
}