GeeCON Prague 2014*
The moose likes Swing / AWT / SWT and the fly likes Add Drag and Drop functionality to JPanel? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Add Drag and Drop functionality to JPanel?" Watch "Add Drag and Drop functionality to JPanel?" New topic
Author

Add Drag and Drop functionality to JPanel?

Matt Senecal
Ranch Hand

Joined: Dec 01, 2000
Posts: 255
I'm trying to add drag-and-drop functionality to a JPanel. Specifically, I want to create a JPanel that accepts drops of other Components. In looking over the documentation and example code, it seems that I need to implement a custom TransferHandler for the JPanel, but I'm a little confused as to how to start. Can I just do a


Does anyone know of an existing example of how to do this? I'd appreciate a push in the right direction.
Thanks!


There's nothing more dangerous than a resourceful idiot. ---Dilbert
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

I could give you help pre 1.4 but as I understand it with 1.4 you only need to set some variable to TRUE and it will start accepting drops.
Of course its got to be able to understand what its receiving somehow. I haveent looked into the 1.4 architecture.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Have you run across Sun's Java Tutorial on Drag and Drop?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Matt Senecal
Ranch Hand

Joined: Dec 01, 2000
Posts: 255
Yes, and it was very high-level.
Originally posted by Dirk Schreckmann:
Have you run across Sun's Java Tutorial on Drag and Drop?
 
GeeCON Prague 2014
 
subject: Add Drag and Drop functionality to JPanel?