开发者

Java JFrame keeping focus when visible

开发者 https://www.devze.com 2023-01-05 03:27 出处:网络
I am not sure if I 开发者_运维问答have set the right title for this post - so it is possible that there\'s already a post for what I am looking for, if that\'s the case feel free to close this and red

I am not sure if I 开发者_运维问答have set the right title for this post - so it is possible that there's already a post for what I am looking for, if that's the case feel free to close this and redirect me - what I am trying to do is this:

When a JFrame is poped the user not to be able to click anywhere else in the gui unless that window is closed, hopefully even throwing that annoying "DING" error sound message much like in netbeans when a "Customize Code" window is open and it's not letting you do anything outside it before it's closed.

Thanks in advance!


JFrame shouldn't be popped as long as you don't want two standalone (top-level) applications running at once, that's why JFrames can NOT be modal. What you probably want is a JDialog set to modal (will even make that annoying sound).


Create the JFrame as a seperate thread so that you will have focus to the current window.

0

精彩评论

暂无评论...
验证码 换一张
取 消