import javax.swing.*; import java.awt.event.*; public class Driver { public static void main(String[] args) { JFrame f = new JFrame(); JPanel p = new JPanel(); f.setSize(640,480); f.add(p); JButton makePopup = new JButton "Popup"); JButton goesInvisible = new JButton("Press me"); JButton quitProgram = new JButton("Quit"); MyListener simpleListener = new MyListener(); /* Para1 = x coordinate, Para2 = y coordinate, Para3 = width, Para4 = height */ f.setBounds(0,0,300,200); p.add(goesInvisible); p.add(makePopup); p.add(quitProgram); makePopup.setActionCommand("popup"); goesInvisible.setActionCommand("press"); quitProgram.setActionCommand("quit"); // Register simpleListener as a listener to when the // buttons get pressed goesInvisible.addActionListener(simpleListener); makePopup.addActionListener(simpleListener); quitProgram.addActionListener(simpleListener); // Make the frame visible f.setVisible(true); } }