Question: a. Create a game that helps new mouse users improve their hand-eye coordination. Within a JFrame, display an array of 48 JPanels in a GridLayout

a. Create a game that helps new mouse users improve their hand-eye coordination. Within a JFrame, display an array of 48 JPanels in a GridLayout using eight rows and six columns. Randomly display an X on one of the panels. When the user clicks the correct panel (the one displaying the X), remove the X and display it on a different panel. After the user has successfully “hit” the correct panel 10 times, display a congratulatory message that includes the user’s percentage (hits divided by clicks). Save the file as JCatchTheMouse.java.

b. Review how to use the LocalDateTime class from Chapter 4, and then revise the JCatchTheMouse game to conclude by displaying the number of seconds it takes the user to click all 10 Xs. (For this program, assume that the user starts and stops the game during the same hour. That way, you only have to compare the minute and second values of the start and stop times.) Save the file as JCatchTheMouseTimed.java.

Step by Step Solution

3.33 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a import javaawt import javaxswing import javaawtevent public class JCatchTheMouse extends JFrame implements MouseListener final int ROWS 8 final int COLS 6 final int GAP 2 final int NUM ROWS COLS fin... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming 8th Questions!