Jeff Storey
Jeff Storey

Reputation: 57192

Java Drag and Drop Show Item Being Dragged

I've implemented drag and drop in my JTree, but I'm wondering is there a way to show the item(s) being dragged while dragging (such as when dragging in Windows Explorer or dragging files in Eclipse for example)?

Upvotes: 4

Views: 1140

Answers (1)

Steve Jackson
Steve Jackson

Reputation: 1330

The trick is to add an additional layer (JPanel) over your app to render the images as they drag. Romain Guy wrote a slick and easy example of this a few years ago:

http://www.jroller.com/gfx/entry/drag_with_style_in_swing

Upvotes: 5

Related Questions