PK Q[1_@2 Driver.javapublic class Driver { public static void main(String[] args) { MyPanel panel = new MyPanel(); MyFrame frame = new MyFrame("Example1", panel); frame.show(); } } PK Q[1'* MyFrame.java/* * This class creates a window on the display. */ import java.awt.*; // required for Dimension import javax.swing.*; public class MyFrame extends JFrame { private JPanel panel; private static final int FRAME_WIDTH = 300; private static final int FRAME_HEIGHT = 400; private static final int XCOORD = 100; private static final int YCOORD = 200; private String title; public MyFrame(String title, JPanel panelIn) { panel = panelIn; setContentPane(panel); setLocation(XCOORD, YCOORD); setSize(new Dimension(FRAME_WIDTH, FRAME_HEIGHT)); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setTitle(title); } } PK c[1jVVDebuggingEx1.javaimport javax.swing.*; public class DebuggingEx1 { public void TestOne() { int x = 2, y = 0; System.out.println("Div: " + (x/y)); System.out.println("Prod: " + (x*y)); } public void TestTwo() { int[] data = {10, 20, 30, 40, 50}; for (int i=0; i<=data.length; i++) { System.out.println(data[i]); } } public static void main(String[] args) { DebuggingEx1 ex = new DebuggingEx1(); String choice = JOptionPane.showInputDialog("Which test (1 or 2)?"); if (choice.equals("1")) { ex.TestOne(); } else { ex.TestTwo(); } } }PK 6R[1llMouseHandler.java/* * This class shows what happens when you use click on * mouse buttons. Look at the console to see messages * corresponding to the events triggered by the mouse. * By the way, try to get out of the area defined by the * window and you will see how an appropriate message is * generated. * */ /* Required because we are dealing with events */ import java.awt.event.*; /* * The MouseListener interface defines the methods * that are associated with mouse actions. The * MouseHandler is the class where you will define * what should take place when a mouse event is * recognized. */ public class MouseHandler implements MouseListener { /* * Invoked when the mouse button has been clicked * (pressed and released) on a component. */ public void mouseClicked(MouseEvent e){ // No activity for now } /* Invoked when the mouse enters a component.*/ public void mouseEntered(MouseEvent e){ System.out.println("Mouse Entered"); } /* Invoked when the mouse exits a component. */ public void mouseExited(MouseEvent e){ System.out.println("Mouse Exited"); } /* Invoked when a mouse button has been pressed on a component.*/ public void mousePressed(MouseEvent e){ System.out.print("Mouse Pressed at coordinates: "); System.out.println("(" + e.getX() + "," + e.getY() + ")"); } /* Invoked when a mouse button has been released on a component. */ public void mouseReleased(MouseEvent e){ System.out.println("Mouse Released"); } } PK Q[1 MyPanel.java/* * This class represents what we want to put on a Window. * For now we are just indicating that the class MouseHandler * will take care of Mouse events. */ import javax.swing.*; public class MyPanel extends JPanel { public MyPanel() { // We are specifying that the MouseHandler class we // define will take care of mouse events addMouseListener(new MouseHandler()); } } PK 2L[1#X .classpath PK 2L[1Ox.project LabWk10 org.eclipse.jdt.core.javabuilder org.eclipse.jdt.core.javanature PK Q[1_@2 Driver.javaPK Q[1'* MyFrame.javaPK c[1jVVDebuggingEx1.javaPK 6R[1llMouseHandler.javaPK Q[1  MyPanel.javaPK 2L[1#X .classpathPK 2L[1Ox.projectPK