简体   繁体   中英

Java JFrame keeping focus when visible

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).

将JFrame创建为单独的线程,以便将焦点集中在当前窗口上。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM