import java.awt.Frame; import java.awt.event.*; public class Raam2{ public static void main(String argumendid[]){ Frame f=new Frame("Raam nr 2"); f.setSize(300, 200); f.setVisible(true); f.addWindowListener(new Raami2kuular()); } } class Raami2kuular extends WindowAdapter{ public void windowClosing(WindowEvent e){ System.out.println("Programmi ots"); System.exit(0); } }