Topic: 关于退出时消息处理

  Print this page

1.关于退出时消息处理 Copy to clipboard
Posted by: JavaCodinger
Posted on: 2004-02-26 10:33

我在windowClosing中加了如下代码:
int option =JOptionPane.showConfirmDialog(null,"Exit now ?","Exit dialog",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE);
switch (option) {
case JOptionPane.YES_OPTION :        System.exit(0);
break;
case JOptionPane.NO_OPTION:
break;
}

但是我点no的时候它仍然会退出程序 不知道为什么 请指教Blush

2.Re:关于退出时消息处理 [Re: JavaCodinger] Copy to clipboard
Posted by: JavaCodinger
Posted on: 2004-03-02 14:50

没人回Black Eye

3.Re:关于退出时消息处理 [Re: JavaCodinger] Copy to clipboard
Posted by: suweisuwei
Posted on: 2004-03-04 09:52

JavaCodinger wrote:
我在windowClosing中加了如下代码:
int option =JOptionPane.showConfirmDialog(null,"Exit now ?","Exit dialog",JOptionPane.YES_NO_CANCEL_OPTION,JOptionPane.QUESTION_MESSAGE);
switch (option) {
case JOptionPane.YES_OPTION :        System.exit(0);
break;
case JOptionPane.NO_OPTION:
break;
}

但是我点no的时候它仍然会退出程序 不知道为什么 请指教Blush

case JOptionPane.YES_OPTION : System.exit(0);
break;
case JOptionPane.NO_OPTION: System.exit(0);

4.Re:关于退出时消息处理 [Re: JavaCodinger] Copy to clipboard
Posted by: floater
Posted on: 2004-03-05 02:16

Because it's "windowClosing", you need to capture this before you reach windowClosing.

5.Re:关于退出时消息处理 [Re: JavaCodinger] Copy to clipboard
Posted by: JavaCodinger
Posted on: 2004-03-05 13:22

thank U .I know


   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