Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- What you get:
- Class Program2 does the following:
- It declares a set of 6 constants, 2 integer variables, and a Random object.
- The main() method sets up the program’s JFrame and calls the loop() method.
- The loop() method picks a random point (row, column) inside the boundaries of the square, pauses the program for 2 seconds, and asks the JFrame to re-paint itself. This causes the program to constantly re-draw a new tunnel every 2 seconds.
- The paint() method must draw the tunnel using the current row and column.
- Class Wait is used to pause the program for 2 seconds using Wait.manySec(2);
- Your Job:
- In the paint method in class Program2 add code so that your program draws the square and lines as shown.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement