Page 1 of 1

HOW TO SOLVE THIS PROBLEM: The type Applet has been deprecated since version 9 and marked for removal Write a java progr

Posted: Sun Jul 03, 2022 11:59 am
by answerhappygod
HOW TO SOLVE THIS PROBLEM: The type Applet has been deprecated since version 9 and marked for removal
Write a java program using window events, mouse events, and the Delegation Event Model. Beginning with the file Proj06.java, create 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. When you place both files in the same folder, compile them both, and run the file named Proj06.java, the program should display the text below:
Display a single 300-pixel by 100-pixel Frame object like 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, which is beyond the reach of the mouse pointer.)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 take class inheritance into account to meet these specifications.
How To Solve This Problem The Type Applet Has Been Deprecated Since Version 9 And Marked For Removal Write A Java Progr 1
How To Solve This Problem The Type Applet Has Been Deprecated Since Version 9 And Marked For Removal Write A Java Progr 1 (6.23 KiB) Viewed 22 times
/*File Proj06
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.
************************************************************/
// Student must not modify the code in this file.
public class Proj06 {
public static void main(String[] args){
new Proj06Runner();
}//end main
}//end class Proj06
//========================================================//
/*File Proj06Runner
************************************************************/
import java.awt.*;
import java.applet.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.Color;
public class Proj06Runner extends Applet {
public Proj06Runner() {
System.out.println( "I certify that this program is my own work \n"+
"and is not the work of others. I agree not \n" +
"to share my solution with others.\n" +
"NAME\n");
}
JTextField f1;
String str;
public void init() {
Frame title = (Frame)this.getParent().getParent();
title.setTitle("NAMEr");
setSize(300, 100);
JPanel grid = new JPanel();
grid.setSize(300,100);
add(grid, BorderLayout. CENTER);
f1=new JTextField(20);
add(f1);
addMouseListener( new MouseAdapter() {
public void mouseClicked(MouseEvent m) {
str="x = "+m.getX()+" y = "+m.getY();
f1.setText(str);
f1.setForeground(Color.red);
}
}
);
addMouseMotionListener(new MouseMotionAdptr() {
public void mouseMoved(MouseEvent m) {
str=" x = "+m.getX()+" y = "+m.getY();
f1.setText(str);
f1.setForeground(Color.red);
}
}
);
}
}
DO NOT COPY AND PASTE YOUR ANSWER I WILL CONTACT answers FOR WASTING MY QUESTION
Display your name here x = 4, y = 30 X
Display your name here X x = 210, y = 94
Display your name here x = 5, y = 94 X