Answered step by step
Verified Expert Solution
Link Copied!

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 Proj06Runner.java to meet the specifications given below.
Note that you must not modify the code in the file named Proj06.java. 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 Proj06.java, 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 =300
The Frame height =100
Top border =30 pixels
Left border =7 pixels
Right border =7 pixels
Bottom border =7 pixels
In addition, your program must display a single 300-pixel by 100-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 0,0 coordinate location is at the outer upper-left 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 7 pixels, you should be able to display a horizontal coordinate value of 8 or 9 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 bottom-left 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 X-button in the upper-right 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.
Proj06.java
/*File Proj06 Copyright 2020 R.G.Baldwin
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 10/29/22
************************************************************/
// Student must not modify the code in this file.
import java.awt.*;
public class Proj06{
public static void main(String[] args){
Proj06Runner theRunner = new Proj06Runner();
//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 Proj06

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. How old are they? (children, teens, adults, seniors)

Answered: 1 week ago

Question

4. Where do they live? (city or town, state, country)

Answered: 1 week ago