Create a Java program that detects whether the mouse is clicked inside or outside a circle. (70 points) The circle shoul
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Create a Java program that detects whether the mouse is clicked inside or outside a circle. (70 points) The circle shoul
Create a Java program that detects whether the mouse is clickedinside or outside a circle. (70 points) The circle should have aradius of 50 with its origin placed at a user-defined point on theJPanel. The program shall prompt the user to define the origin byclicking the mouse on the JPanel (20 points). If the user definesan origin that will result in a circle not fully contained withinthe JPanel’s dimensions, the program shall return an error andprompt the user to make another selection (20 points). Once theuser defines valid coordinates for the origin, the program drawsthe circle and prompts the user to click the mouse anywhere in theJPanel. When the user clicks the mouse, the program should draw aline from the circle's origin to the location of the mouse click(15 points). Finally, a JOptionPane should display the distance(from the circle's origin to the location of the mouse click) and amessage that indicates whether the mouse was clicked inside oroutside the circle. (15 points).