I would like to convert my Simple Java program to an Applet Program. I've looked for different tutorials but all were in general most of it didn't talk about GUI to Applet.
This is my simple program if you could instruct me to do it or comment on the changed lines I would be so much appreciated.
Here is the code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test_Exam_091 {
public static void main(String[] args) {
new MyFrame();
}
}
class MyFrame extends JFrame implements MouseListener {
public MyFrame() {
setTitle("Playing With The Mouse!");
setSize(400, 400);
setResizable(false);
setVisible(true);
addMouseListener(this);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
show();
}
public void mouseEntered(MouseEvent me) {
System.out.println("Mouse entered at: ("
+ me.getX() + ", " + me.getY() + ")");
}
public void mouseExited(MouseEvent me) {
System.out.println("Mouse exited at: ("
+ me.getX() + ", " + me.getY() + ")");
}
public void mouseClicked(MouseEvent me) {
System.out.println("Mouse clicked at: ("
+ me.getX() + ", " + me.getY() + ")");
}
public void mousePressed(MouseEvent me) {
System.out.println("Mouse pressed at: ("
+ me.getX() + ", " + me.getY() + ")");
}
public void mouseReleased(MouseEvent me) {
System.out.println("Mouse released at: ("
+ me.getX() + ", " + me.getY() + ")");
}
} // End of MyFrame class