View Full Version : [java] chiusura finestra
1-Vorrei che al click sul tasto x della finestra la finestra venga chiusa con dispose();
2-al click sul tasto x della finestra la finestra , prima di chiudersi esegue una funzione
AbuJaffa
08-06-2006, 21:16
Doresti implementare WindowListener e controllare l'evento windowClosing:
esempio:
public class Test extends JFrame implements WindowListener{
public static void main(String args[]) {
Test frame = new Test();
frame.setVisible(true);
}
public Test() {
super("This is a test");
addWindowListener(this);
}
public void windowClosing(WindowEvent arg0) {
//esegui una funzione oppure dispose()
System.out.println("bye bye");
}
}
Ciao. ;)
vBulletin® v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.