首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件开发 >

捕杀JDialog的关闭事件

2014-04-30 
捕捉JDialog的关闭事件对应的事件是?windowClosing? ? ?public class EditJDialog extends JDialog implem

捕捉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

热点排行