animation for drag and drop JLabel
I have ask alot of question about drag and drop for JLabel , but im learning from them ,im trying to drag and drop JLabel with image icon inside it , i want to be able to make a copy from it and drag it while user can see the image moving with the mouse and drop it in another JLabel , also i want to move it from one JPanel to another,how i can开发者_运维问答 do this ?
In principle, you need the java.awt.dnd
package.
Get a DragSource
, associate it with your source JLabel. Create a DropTarget, associate it with your target JLabel.
Add the right listeners (DropTargetListener, DragSourceListener), and react on the method calls appropriately.
Okay, seriously: Read the tutorial, try to implement it, and come back if you have more concrete problems.
精彩评论