right hand corner of a window?
[*] Create an event handler class to extend WindowAdapter. Then override WindowAdapter’s windowClosing() to do the actions you want when a window’s “close” action is clicked. Then add that to the listeners for that window. import java.awt.*; import java.awt.event.*; public class MyFrame extends Frame { public MyFrame(String s) {super(s);} public class WL extends WindowAdapter { public void windowClosing(WindowEvent e) {System.exit(0);} } // do your other Frame stuff } Somewhere in your initialization code, put: f1.addWindowListener( f1. new WL() ); This last syntax is not commonly known to many people yet, it’s another wacky artifact of inner classes. Alternatively, combining the inner class and setting the handler in one go, you could do this: MyFrame f1 = new f(“wave”); f1.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { // and/or setVisible(false) and/or dispose() System.exit(0); } }); See also the answer to questions 1.0.19, 1.0.30 and 15.7.