我正在使用JOGL2和NativeWindow API用Java编写应用程序。隐藏鼠标光标的最佳/简便方法是什么?
[编辑]
我没有使用JFrame创建窗口,而是从JOGL创建了GLWindow。 GLWindow没有setCursor方法。这还有可能吗?
最佳答案
正如您(孩子)说的GLWindow
不具备此功能,因此我将在GLCanvas
(或Frame
)内使用JFrame
(例如AlexR写道):
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);
}