捕捉JDialog的关闭事件
对应的事件是?windowClosing
? ? ?public class EditJDialog extends JDialog implements WindowListener{
?
public EditJDialog(Frame owner, boolean modal) {
super(owner, modal);
setSize(800, 600);
setVisible(true);
//setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
this.addWindowListener((WindowListener) this);
}
?
@Override
public void windowActivated(WindowEvent e) {
System.out.println(0);
?
}
?
@Override
public void windowClosed(WindowEvent e) {
// TODO Auto-generated method stub
System.out.println(1);
}
?
@Override
public void windowClosing(WindowEvent e) {
// TODO Auto-generated method stub
System.out.println(2);
}
?
@Override
public void windowDeactivated(WindowEvent e) {
System.out.println(3);
}
?
@Override
public void windowDeiconified(WindowEvent e) {
// TODO Auto-generated method stub
System.out.println(4);
}
?
@Override
public void windowIconified(WindowEvent e) {
// TODO Auto-generated method stub
System.out.println(5);
}
?
@Override
public void windowOpened(WindowEvent e) {
// TODO Auto-generated method stub
System.out.println(6);
}
}
?
出处:http://xxqn.iteye.com/blog/431190