Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

custom cursor???  RSS feed

 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to display a custom cursor without having to set it up with the operating system first? can I set a small graphic in place of the cursor when the mouse is over some component? I haven't been able to find much about this in the java docs or the tutorial. Is it possible at all?
 
Navin Jayaraman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes you can use gif cursors. But I've problem using animated Gif files. You can safely use unanimated Gif files for your cursors.
Use this piece of code...

JButton b = new JButton("Click");
Image im = Toolkit.getDefaultToolkit().getImage("..path../imagename.gif");
try
{
b.setCursor(Toolkit.createCustomCursor(im, new Point(0, 0), "Some Name");
}catch(Exception e) {}



[This message has been edited by Bodie Minster (edited November 27, 2000).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!