my dog learned polymorphism*
The moose likes Java in General and the fly likes Using Custom Cursors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Using Custom Cursors" Watch "Using Custom Cursors" New topic
Author

Using Custom Cursors

Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

I have some animation on a JPanel, and I also have a custom cursor that I built like this:
Toolkit tk = Toolkit.getDefaultToolkit();
target = tk.getImage("target.jpg");
sights = new JButton();
sights.setCursor(tk.createCustomCursor(target,new Point(0,0),"cursor"));

Now my problem comes in when I try to add it to the JPanel. It does not show up at all. I just have the normal mouse cursor. If I add it to the Container before I add the JPanel, I only get the cursor and not the JPanel. If I add the cursor after I add the JPanel, I get only the JPanel. I need to have the animation
and the custom cursor on the same JPanel. If anyone can help me with this, I would greatly appreciate it. Thanks!!!

 
wood burning stoves
 
subject: Using Custom Cursors
 
Similar Threads
Java Swing Custom Cursor ( Mac styled rotating dots busy cursor)
well did as below but BUTTONS NOT Appear only the image plays continuesly, well
Trouble Aligning JButtons (And setting width)
Using Custom Cursors
repaint() method? Something's fishy...