Is there a possibility to create a larger cursor (by the method createCustomCursor()) than the predefined 32x32 in Windows (e.g. 64x64 or even more)?
Toolkit toolkit = Toolkit.getDefaultToolkit();
final Image cursor = toolkit.getImage(getClass().getClassLoader().getResource("images/cursor.png"));
toolkit.getBestCursorSize(64, 64);
Cursor mycursor=toolkit.createCustomCursor(cursor, new Point(0,0), "cursor");
setCursor(mycursor);
I tried the following:
Cursor emptyCursor = Toolkit.getDefaultToolkit().createCustomCursor(new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB), new Point(0, 0), "empty");
setCursor(emptyCursor);
this.addMouseMotionListener(new MouseMotionListener(){
public void mouseDragged(MouseEvent e) {
}
public void mouseMoved(MouseEvent e) {
xCursor = e.getX();
yCursor = e.getY();
repaint();
//e.consume();
}
});
public void paint( Graphics g ) {
g.drawImage(cursor, xCursor, yCursor, null);
}
But it doesn't work, the whole GUI disappears, and the cursor is drawn at every point so i have to delete it in a way?
Is there a method to make a cursor smaller than the predefined 32x32? If so just make a cursor so tiny that it really can't be noticed, or make a transparent cursor... THEN, just move an image to the coordinates of the cursors current location every (insert desired time interval here)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With