java setFullScreenWindow hides log in dialog in Mac

橙三吉。 提交于 2019-12-13 16:40:01

问题


I was using a full screen window to something similar to screensaver. Using the method here,

GraphicsEnvironment.getLocalGraphicsEnvironment()
                  .getDefaultScreenDevice()
                  .setFullScreenWindow(this);

But when the screen is locked, or the screensaver runs, and this screen is shown, this screen is shown on top. I can't get access to the login prompt. So the java frame is on top and I can do nothing. I have to restart the computer to get rid of this.

Since when the login screen comes, no other window gets mouse/keyboard input. My window exit by pressing ESC or mouse movement events.

How can I get hold of the whole screen, but if the login dialog appears, it should be shown on top?


回答1:


I am afraid that clear, pure java solution does not exist here. I'd suggest you to check whether the screen saver is running before opening this full screen window. So the question is how to detect whether screen saver is running? You are welcome to search yourself but my fast investigation showed that you need platform specific code.

The following link shows 2 solutions for windows: How to determine if a screensaver is running in Java?

Probably the second solution can help you in case of MAC. Check whether you can identify the process of screen saver. If you can just get list of running processes (by execution external command line) and verify that such process is running.



来源:https://stackoverflow.com/questions/6890379/java-setfullscreenwindow-hides-log-in-dialog-in-mac

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!