Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Changing the Mouse pointer to a Zoom Icon

843806Feb 11 2008 — edited Feb 11 2008
Hello All,

In our application we have zoom functionality.
On click of a toggle button the zooming gets enabled.
At this point the cursor should be changed to a magnifying glass to denote zooming process.

All this has been achieved, however as soon as the cursor switches to the zoom icon the image gets distorted.

The image being used is pretty impressive with properties 16*16, gif.

I tried some other dimensions also but in vain.

Kindly give me some suggestions.

the code to set the cursor goes as follows
Toolkit toolkit = Toolkit.getDefaultToolkit();
Point hotSpotPoint = new Point(1,1); // trail and error 
ImageIcon zoominImg = createImageIcon("images/t1.gif", "");
Cursor  zoomInCursor = toolkit.createCustomCursor(zoominImg.getImage(), hotSpotPoint, "ZOOM_IN_CURSOR");
mainWindowFrame.setCursor(zoomInCursor);
Also how to identify the hotspotPoint ?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2008
Added on Feb 11 2008
2 comments
211 views