Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Make a new file named Proj 0 6 Runner.java to meet the specifications given below. Note that you must not modify the code in the
Make a new file named ProjRunner.java to meet the specifications given below.
Note that you must not modify the code in the file named Projjava. Make sure that you understand the comments and the code in that file.
Be sure to display your name in both locations in the output as indicated.
When you place both files in the same folder, compile them both, and run the file named Projjava, the program must display the text shown below on the command line screen. Note however that the border widths may vary from one system to the next. The border widths are being displayed to help you understand the coordinate values on your system.
the following should display when the proogram is run:
I certify that this program is my own work
and is not the work of others. I agree not
to share my solution with others.
Replace this line with your name
The Frame width
The Frame height
Top border pixels
Left border pixels
Right border pixels
Bottom border pixels
In addition, your program must display a single pixel by pixel Frame object as shown in the images below. When you click the mouse in the working area of the Frame, the coordinates of the mouse pointer must be shown in RED above the mouse pointer. Multiple images are shown below to show the result of clicking at different locations in the working area of the Frame. Note that the coordinate location is at the outer upperleft corner of the Frame object, which is beyond the reach of the mouse pointer. Also note that the minimum possible values that can be displayed in full for the x and y coordinates are determined by the width of the left and top borders as well as your font size.
As further clarification, when you click with the mouse pointer very close to the border on the left, the program must display a horizontal x coordinate value slightly larger than the width of the border. For example, for a left border width of pixels, you should be able to display a horizontal coordinate value of or pixels, depending on your ability to accurately place the mouse pointer when you click. The coordinate value must be displayed above and to the right of the mouse pointer. The tip of the mouse pointer must be at the bottomleft corner of the first text character.
When you click just far enough below the top banner to be able to read the text, the program must display a vertical y coordinate value approximately equal to the sum of the banner height and the height of the text.
When you click as close as possible to the bottom border, the program must display a vertical y coordinate value approximately equal to the Frame height minus the thickness of the bottom border.
When you click close to the border on the right, most and perhaps all of the text will not be visible.
Each time you click the mouse, the old coordinates must be erased before new ones are displayed.
When you click the Xbutton in the upperright corner of the Frame object, the program must terminate and MUST RETURN CONTROL TO THE OPERATING SYSTEM.
You may find it necessary to consult the Java documentation and take class inheritance into account to meet these specifications.
Projjava
File Proj Copyright RGBaldwin
The purpose of this assignment is to assess the student's
ability to write a program dealing with window events,
mouse events, and the Delegation Event Model.
Revised
Student must not modify the code in this file.
import java.awt.;
public class Proj
public static void mainString args
ProjRunner theRunner new ProjRunner;
IMPORTANT Your runner class must contain a method named
getFrame that returns a reference to the Frame object
in which you will display the coordinates.
Frame theFrame theRunner.getFrame;
System.out.println
"The Frame width theFrame.getWidth;
System.out.println
"The Frame height theFrame.getHeight;
Insets theInsets theFrame.getInsets;
System.out.println
"Top border theInsets.top pixels";
System.out.println
"Left border theInsets.left pixels";
System.out.println
"Right border theInsets.right pixels";
System.out.println
"Bottom border theInsets.bottom pixels";
end main
end class Proj
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started