I created a cursor using:
BufferedImage im=null;
try {
im = ImageIO.read(new File("images/cursor1.jpg"));
} catch (IOException ex) {
Logger.getLogger(SRGView.class.getName()).log(Level.SEVERE, null, ex);
}
Cursor cursor = getToolkit().createCustomCursor(im, new Point(1,1), "s");
this.setCursor(cursor);
The cursor1.jpg is 5X5 (in pixels). However, when it is displayed on the screen, it is much larger. I would like to make cursors of size 1X1, 5X5, 10X10. I would rather prefer creating the image dynamically than read the image file. i.e.
for (int x = 0; x < w; x++) {
for (int y = 0; y < h; y++) {
im.setRGB(x, y, new Color(255, 0, 0).getRGB());
}
}
The above code would create a red image "im" of width, w and height, h and I would like to use that as my cursor.
How to do it?