Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Custom Cursors

 
Barry Andrews
Ranch Hand
Posts: 523
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have some animation on a JPanel, and I also have a custom cursor that I built like this:
<code>
Toolkit tk = Toolkit.getDefaultToolkit();
target = tk.getImage("target.jpg");
sights = new JButton();
sights.setCursor(tk.createCustomCursor(target,new Point(0,0),"cursor"));
</code>
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!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic