当前位置: 技术问答>java相关
急问:JInternalFrame的关闭事件怎么设?
来源: 互联网 发布时间:2015-05-09
本文导语: this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { getRootPane().validate(); } }); 好像不行 | addInternalFrameListener(new InternalFrameListener(){ public void intern...
this.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
getRootPane().validate();
}
});
好像不行
{
public void windowClosing(WindowEvent e)
{
getRootPane().validate();
}
});
好像不行
|
addInternalFrameListener(new InternalFrameListener(){
public void internalFrameActivated(InternalFrameEvent e){}
public void internalFrameClosed(InternalFrameEvent e) {}
public void internalFrameClosing(InternalFrameEvent e) {}
public void internalFrameDeactivated(InternalFrameEvent e) {}
public void internalFrameDeiconified(InternalFrameEvent e) {}
public void internalFrameIconified(InternalFrameEvent e) {}
public void internalFrameOpened(InternalFrameEvent e) {}
});
public void internalFrameActivated(InternalFrameEvent e){}
public void internalFrameClosed(InternalFrameEvent e) {}
public void internalFrameClosing(InternalFrameEvent e) {}
public void internalFrameDeactivated(InternalFrameEvent e) {}
public void internalFrameDeiconified(InternalFrameEvent e) {}
public void internalFrameIconified(InternalFrameEvent e) {}
public void internalFrameOpened(InternalFrameEvent e) {}
});
|
在构造函数里加上这一句:
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);