Topic: 关于JFrame的关闭问题

  Print this page

1.关于JFrame的关闭问题 Copy to clipboard
Posted by: eric_dasini
Posted on: 2004-09-23 11:46

请问,我用JFrame,如何在我点击右上角的关闭按钮时弹出对话框.
急!!!!!!!!!!!!!!
谢谢了!!!!!

2.Re:关于JFrame的关闭问题 [Re: eric_dasini] Copy to clipboard
Posted by: yamakasy
Posted on: 2004-09-23 13:22

重载关闭事件

3.Re:关于JFrame的关闭问题 [Re: eric_dasini] Copy to clipboard
Posted by: hello105
Posted on: 2004-09-23 15:07

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

4.Re:关于JFrame的关闭问题 [Re: eric_dasini] Copy to clipboard
Posted by: AnthonyPig
Posted on: 2004-09-25 23:47

windowEvent

5.Re:关于JFrame的关闭问题 [Re: eric_dasini] Copy to clipboard
Posted by: karsking
Posted on: 2004-09-29 11:02

在addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
dialog.show();//dialog是前面初始化定义的JDialog类;
}
});
其他详细定义还需要进行加工,再这仅提供参考;

6.Re:关于JFrame的关闭问题 [Re: eric_dasini] Copy to clipboard
Posted by: Donnyzhao
Posted on: 2004-10-07 12:17

addWindowListener(new WindowAdpt());

class WindowAdpt extends WindowAdapter
{
  public void windowClosing(WindowEvent e)
  {
    Frame frm=(Frame)(e.getSource());
    frm.dispose();
    System.exit(0);
  }
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923