我正在使用 JOGL2 和 NativeWindow API 用 Java 编写应用程序。如何隐藏鼠标光标?
[编辑]
我没有使用 JFrame 创建窗口,而是使用 JOGL 的 GLWindow。 GLWindow 没有 setCursor 方法。这还有可能吗?
最佳答案
正如你(开玩笑的人)所说,GLWindow
没有这种能力,所以我会在 Frame
(或 JFrame)中使用
) 像这样(就像 AlexR 写的那样):GLCanvas
public static void main(String... args) {
// create the cursor
Toolkit t = Toolkit.getDefaultToolkit();
Image i = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);
Cursor noCursor = t.createCustomCursor(i, new Point(0, 0), "none");
// try it with a normal frame
Frame f = new Frame();
// create the GLCanvas and add it to the frame
GLCanvas canvas = new GLCanvas();
frame.add(canvas);
f.setCursor(noCursor);
f.setSize(400, 200);
f.setVisible(true);
}
关于java - 如何使用 JOGL2 隐藏鼠标光标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4317842/