Swing drag & drop question
Here is a photo of the application I'm running:
My task is to drag the ship photo/label/button from the left panel to the right one and drop it over a cell.
My question is what classes/methods I have to use and how(extend/implement/etc..)?
(I tried using TransferHandler("icon"), with this I didn't manage to get any information about the action so it just pops into a single cell and changes it's size.)
Thanks in advance.
Re: Swing drag & drop question
It's all about DnD (Drag and Drop) in Java. Basically you have to think about three levels.
1. Drag source
2. Data transfer
3. Drop source
Following document explains the all. Have a look at it and if you are stuck on anything let us know.
Lesson: Drag and Drop and Data Transfer (The Java™ Tutorials > Creating a GUI With JFC/Swing)
Pay your attention that, in DnD with IO process still there are some of know issues exist (I haven't check them with Java 7 and such). Worth to have a look around.