Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java GUI 设计 » SWT  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 请教:Shell退出时的问题
snail





发贴: 2
积分: 0
于 2005-02-13 16:48 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我想在一个类似写字板的程序里,添加一个功能
就是在退出时,询问是否保存
shell.addShellListener(new ShellAdapter(){
public void shellClosed(ShellEvent e){
int flag = 0;
if (!saved ){
MessageBox saveMessage=
new MessageBox(shell, SWT.YES | SWT.NO |
SWT.CANCEL | SWT.ICON_WARNING);
saveMessage.setMessage("还未保存,是否保存?");
flag = saveMessage.open();
if (flag == SWT.YES) {
try {
save();
}catch (IOException event){
event.printStackTrace();}}
if (flag == SWT.NO);
if (flag == SWT.CANCEL) {
//这里如何写,使MessageBox退出时,程序不要关闭
};
}
}});
用shell.wait();错误提示不是用户线程
请问有什么办法使shell可以中止退出的过程


snail edited on 2005-02-13 21:38


话题树型展开
人气 标题 作者 字数 发贴时间
4588 请教:Shell退出时的问题 snail 720 2005-02-13 16:48
4112 Re:请教:Shell退出时的问题 wdh113 49 2005-02-13 23:24
3732 Re:请教:Shell退出时的问题 snail 31 2005-02-14 00:35
3949 Re:请教:Shell退出时的问题 VirusCamp 7932 2005-02-28 12:35

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   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