Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Beginning with the file that you downloaded named Proj 0 7 . java, make a new file named Proj 0 7 Runner.java to meet the
Beginning with the file that you downloaded named Projjava, 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.
When run it should display the following:
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.
Print your name here.
The JFrame width
The JFrame height
JFrame insets
The JPanel width
The JPanel height
JPanel insets
Also:
In addition, your program must display a single pixel by pixel JFrame object as shown in the images below.
When you click the mouse in the working area of the JFrame, the coordinates of the mouse pointer must be shown in black above the mouse pointer and old coordinates must be erased. Multiple images are shown below to show the result of clicking at different locations in the working area of the JFrame.
Note that the coordinate location is at the upperleft corner of the JPanel object, which covers the working area of the JFrame object.
As further clarification, when you click with the mouse pointer very close to the border on the left, the program must display a small horizontal x coordinate value. 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 height of the text, or pixels for example.
When you click as close as possible to the bottom border, the program must display a vertical y coordinate value approximately equal to the JPanel height.
When you click close to the border on the right, most and perhaps all of the text will not be visible.
When you click the Xbutton in the upperright corner of the JFrame object, the program must terminate and MUST RETURN CONTROL TO THE OPERATING SYSTEM.
IMPORTANT UPDATE: The zip file from which you extracted this document has been updated to contain all of the class files for my version of the program. Before you submit your assignment, please run your code sidebyside with my code and confirm that the behavior of your version matches the behavior of my version. By match I mean they show the same coordinate values, same text font, same text size, etc. for the same types of events. Pay particular attention to the coordinate values in the upperleft corner of the window. You may need to use the drawString method to cause your text to match my text. If you have issues running my code, please let me know. That would probably be the result of a Java version issue and I will help you work through it
Projjava
File Projjava
The purpose of this assignment is to assess the student's
ability to write a Swing program handling mouse events on
a JFrame object containing a JPanel object.
import javax.swing.;
import java.awt.;
public class Proj
public static void mainString args
ProjRunner theRunner new ProjRunner;
JFrame theJFrame theRunner.getJFrame;
System.out.println
"The JFrame width theJFrame.getWidth;
System.out.println
"The JFrame height theJFrame.getHeight;
Insets JFrameInsets theJFrame.getInsets;
System.out.printlnJFrame insets";
System.out.println
JFrameInsets.top JFrameInsets.left
JFrameInsets.right JFrameInsets.bottom;
JPanel theJPanel theRunner.getJPanel;
System.out.println
"The JPanel width theJPanel.getWidth;
System.out.println
"The JPanel height theJPanel.getHeight;
Insets JPanelInsets theJPanel.getInsets;
System.out.printlnJPanel insets";
System.out.println
JPanelInsets.top JPanelInsets.left
JPanelInsets.right JPanelInsets.bottom;
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