import javax.swing.*; import java.awt.*; class Action extends JFrame implements ActionListener { public Action () { /* define all panels and components in this frame here */ /* action to be performed when frame is closed */ addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(O); } } ); } public void actionPerformed(ActionEvent evt) { /* will respond to events fired by the frame */ } }