Hey guys!!
I'm having trouble with having a custom Cursor in shape of a Sniper scope reticle..
what i want is that the the crosshair of the reticle be the mouse pointer but all i get is a small image about 15px X 15px with the top left corner as the mouse pointer..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| import java.awt.event.*; import java.awt.*; import javax.swing.*;
public class SniperCursor { public SniperCursor() { JFrame myFrame = new JFrame(); myFrame.setSize(400,400); myFrame.setTitle("Sniper Frame"); myFrame.setVisible(true); myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Toolkit toolkit = Toolkit.getDefaultToolkit(); Image cursorImage = toolkit.getImage("MilDotScope.png"); Point cursorHotSpot = new Point(0,0); Cursor customCursor = toolkit.createCustomCursor(cursorImage, cursorHotSpot, "Cursor"); myFrame.setCursor(customCursor); } public static void main (String[] arg) { SniperCursor myWindow = new SniperCursor(); } } |
if i cant do what i want this way.. is there any other way of doing this.. I thought about using MouseMoved() method on a JLabel with the Reticle set as ImageIcon on the JLabel.. but it is not performing as required.

PLEASE HELP!!