File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Using Custom Cursors" Watch "Using Custom Cursors" New topic

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!!!
I agree. Here's the link:
subject: Using Custom Cursors
It's not a secret anymore!