如何在全屏独占模式下摆脱鼠标光标? [英] How do I get rid of the mouse cursor in full-screen exclusive mode?

查看:331
本文介绍了如何在全屏独占模式下摆脱鼠标光标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个简单的Java游戏引擎,并且没有FSEM,缓冲策略等问题;我的问题是用鼠标光标。在窗口模式下,我可以隐藏鼠标光标,没问题,可以使用我的JFrame中的setCursor()来设置一个完全透明的光标。但是,在调用device.setFullScreenWindow(this)进入FSEM后,鼠标光标返回,后续调用setCursor()将其设置回我的空白光标无效。调用device.setFullScreenWindow(null)允许我再次摆脱光标 - 只有当我在FSEM中时才能摆脱它。

I'm working on a simple 2D game engine in Java, and having no trouble with FSEM, buffer strategies, and so on; my issue is with the mouse cursor. In windowed mode, I can hide the mouse cursor, no problem, by using setCursor() from my JFrame to set a wholly-transparent cursor. However, after a call to device.setFullScreenWindow(this) to go into FSEM, the mouse cursor comes back, and subsequent calls to setCursor() to set it back to my blank cursor have no effect. Calling device.setFullScreenWindow(null) allows me to get rid of the cursor again - it's only while I'm in FSEM that I can't get rid of it.

我在JDK 6下工作,目标平台是JDK 5 +。

I'm working under JDK 6, target platform is JDK 5+.

更新:我做了更多测试,看起来像这个问题出现在MacOS X 10.5 w / Java 6u7下,但不是在带有Java 6u7的Windows XP SP3下。所以,它可能是Mac版JVM中的一个错误。

UPDATE: I've done some more testing, and it looks like this issue occurs under MacOS X 10.5 w/Java 6u7, but not under Windows XP SP3 with Java 6u7. So, it could possibly be a bug in the Mac version of the JVM.

推荐答案

我想我终于找到了解决方案:

I think I've finally found the solution:

System.setProperty("apple.awt.fullscreenhidecursor","true");

这是Apple专有的系统属性,当应用程序全屏时隐藏鼠标光标模式。这是我找到修复它的唯一方法。

This is an Apple-proprietary system property that hides the mouse cursor when an application is in full-screen mode. It's the only way I've found to fix it.

这篇关于如何在全屏独占模式下摆脱鼠标光标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆