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

您没有登录

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

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 如何设置在当前窗口未关闭之前无法点击/编辑其他窗口?
zf00110011





发贴: 14
积分: 0
于 2006-05-25 19:30 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
如题。例如很多好的程序一样,在当前窗口未关闭的情况下,其他窗口(包括父窗口)都无法点击和编辑。请问该如何设置?


作者 Re:如何设置在当前窗口未关闭之前无法点击/编辑其他窗口? [Re:zf00110011]
JavaandC





发贴: 230
积分: 15
于 2006-05-26 10:32 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
使用 java.awt.Dialog 或者 javax.swing.JDialog 就可以实现。具体方法参见JDK。



作者 Re:如何设置在当前窗口未关闭之前无法点击/编辑其他窗口? [Re:zf00110011]
smectite





发贴: 1
积分: 0
于 2006-05-27 15:36 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
u can set ur component modal or modelss if it allows


作者 Re:如何设置在当前窗口未关闭之前无法点击/编辑其他窗口? [Re:zf00110011]
liuzhenke15





发贴: 45
积分: 0
于 2006-05-31 21:26 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
使用Dialog可能不是最好的选择,特别是在用IE显示Applet的时候,如果切换桌面的窗口,有可能挡住了当前生效的Dialog,造成了假死机。
如果您想深入一点控制,建议你创建一个透明的窗体放在最前面,然后把你的窗口放在这个窗口的里面。可能需要修改一下鼠标监听程序。



作者 Re:如何设置在当前窗口未关闭之前无法点击/编辑其他窗口? [Re:zf00110011]
lijipeipp





发贴: 16
积分: 0
于 2006-06-30 09:42 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
在监听中增加 焦点的获得代码
让焦点处在目前的窗体上
getFocus();



作者 Re:如何设置在当前窗口未关闭之前无法点击/编辑其他窗口? [Re:zf00110011]
ranchgirl



版主


发贴: 801
积分: 132
于 2006-07-09 22:12 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
Not recommended since its extremely user unfriendly nature!!!!

Thanks!





作者 Re:如何设置在当前窗口未关闭之前无法点击/编辑其他窗口? [Re:ranchgirl]
cxp108





发贴: 363
积分: 12
于 2006-07-10 09:25 user profilesend a private message to usersend email to cxp108search all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
ranchgirl wrote:
Not recommended since its extremely user unfriendly nature!!!!

Thanks!

从人机工程学的角度上,这个建议是很值的考虑的。
不过如果楼主一定需要这个功能的话也不难。绕过API,当这个重要窗口打开时,将一个全局变量
至为true,然后其他窗口都添加上FocusListener,其他窗口一旦获得Focus,就将Focus转移
到重要窗口上。若非迫不得已不要使用这个方法,手动控制Focus失误也非常容易引发假死机。

至于你使用JDialog中假死机的问题,我建议你不要在JDialog构造函数中的parent Component设置成
null,而是将你主窗口的JFrame对象放进去,就不会出现你所说的现象了。



作者 Re:如何设置在当前窗口未关闭之前无法点击/编辑其他窗口? [Re:zf00110011]
garbinghu





发贴: 1
积分: 0
于 2006-07-12 09:29 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
在打开子窗体的时候.将指向父窗体的引用传给子窗体.在子窗体的构造函数中加入(引用) .setEnabled(false);.在子窗体的关闭事件中加入(引用) .setEnabled(true)



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