简体   繁体   English

设置窗口焦点/将其置于前景

[英]Set Window-Focus/Bring it to Foreground

I need to set a focus on a window / bring the application to foreground. 我需要将重点放在窗口上/将应用程序置于前台。 I tried it with .toFront() but it only works if it's called from the actual application that has the actual focus on it. 我使用.toFront()尝试,但是只有从真正关注它的实际应用程序中调用它时,它才有效。

How can I let my java application get back it's focus itself, once it loses it? 一旦丢失,我该如何让我的Java应用程序重新获得焦点呢?

You can run 你可以跑

stage.requestFocus()

where stage is your stage, this should make your stage the focused window. stage是您的舞台,这应该使您的舞台成为聚焦的窗口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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