18 jul 2009

JFrame: two ways to close a window

Two way to make a windows that can be closed created with JFrame .
JFrame window= new JFrame("Test");
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

or

window.addWindowListener(new WindowAdapter(){
@Override
public void windowClosed(WindowEvent e) {
System.exit(0);
}
});

No hay comentarios.: