Minggu, 25 Desember 2011

Java GUI Programming Tips: Create your own mouse cursor icon

As many people wonder how they change their cursor into an elegant icon and shape, I m gonna tell you the secret to do that, this is really important as you need an attraction into your GUI Program user!

Well direct to point what you have to do is:

1. First use Toolkit class to create cursor icon that is:
Cursor myCursor=Toolkit.getDefaultToolkit().createCustomC ursor(myIcon,new Point(0,0),"myCursor");
myIcon = ImageIcon object, Point(0,0) as location of your drawn Icon that is in point of your mouse

2. Than set your icon of mouse (here i use JFrame as GUI window)
myJFrame.setCursor(myCursor);

Tidak ada komentar:

Posting Komentar