the*_*der 3 java jogl mouse-cursor
我正在使用 JOGL2 和 NativeWindow API 用 Java 编写应用程序。如何隐藏鼠标光标?
[编辑]
我没有使用 JFrame 来创建窗口,而是使用 JOGL 中的 GLWindow 来创建窗口。GLWindow 没有 setCursor 方法。这还有可能吗?
正如你(thekidder)所说,GLWindow没有这种能力,所以我会像这样在(或)GLCanvas内部使用(就像AlexR写的):FrameJFrame
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);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1557 次 |
| 最近记录: |