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!

Drag&Drop - how to change cursor?

843804Aug 8 2005 — edited Aug 9 2005
Hi,

I know how to use Drag&Drop but I have two problems:

1. I would like to have my icon displayed right next to the system's default cursor during dnd operation instead of displaying my icon only. How can I achieve this?

2. when I use my own image as cursor during dnd operation, the size of the cursor is incorrect. It's supposed to have 24x24 pixels but it gets displayed in a different size. The ImageIcon still has 24x24 pixels, but the cursor is wrong.

Thanks a lot!

Regards,

Ren�
ImageIcon copyIcon = new ImageIcon("c:\\tmp\\drag_copy.gif");
System.err.println(copyIcon.getIconWidth() + "; " + copyIcon.getIconHeight());
copyCursor = Toolkit.getDefaultToolkit().createCustomCursor(
copyIcon.getImage(), new java.awt.Point(0, 0), "I30COPY");

...

e.startDrag(copyCursor, new StringSelection("DRAGITEM"), this);
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 6 2005
Added on Aug 8 2005
1 comment
60 views