The Source for Java Technology Collaboration

Home » java.net Forums » Java Desktop Technologies » Swing & AWT

Thread: drag-n-drop panel to panel

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 5 - Last Post: Jul 29, 2009 10:04 AM by: sw1679 Threads: [ Previous | Next ]
lordcenzin

Posts: 2
drag-n-drop panel to panel
Posted: Sep 25, 2008 6:32 PM
 
  Click to reply to this thread Reply

Hi all,
I'm quite new to java gui implementations. I'd ike to receive some suggestion on how to perform the drag-n-drop feature from one JPanel to another. The proble is that i need to drag an image (like an icon that represent some entity for my application) and show that image (eventually different). Just like a workflow.

I read all tutorials, but I can't get many efforts. Do I have to consider the java.awt.dnd package?

I hope to receive some suggestion.

Thanks in advance for your kindness!

sauvage

Posts: 65
Re: drag-n-drop panel to panel
Posted: Sep 26, 2008 9:10 AM   in response to: lordcenzin
 
  Click to reply to this thread Reply

In short you should to customize TransferHandler of source and destination panels.
cf http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/TransferHandler.html

lordcenzin

Posts: 2
Re: drag-n-drop panel to panel
Posted: Sep 26, 2008 4:36 PM   in response to: sauvage
 
  Click to reply to this thread Reply

please, can someone explain me if I should use java.awt.dnd package? why?

I'm studying a lot and i'd like to create a good solution.

Thanks in advance

sauvage

Posts: 65
Re: drag-n-drop panel to panel
Posted: Sep 26, 2008 8:47 PM   in response to: lordcenzin
 
  Click to reply to this thread Reply

TransferHandler uses java.awt.dnd package under the hood, but this package is complex to use however it is more feature complete.
I think TransferHandler should be enough for your need.

Denis Fokin
Re: drag-n-drop panel to panel
Posted: Sep 29, 2008 2:53 AM   in response to: lordcenzin
  Click to reply to this thread Reply

Hi,

Use java.awt.dnd package if you are working with AWT package. Do not
mix AWT DnD implementation and Swing DnD implementation in the same project.

--
Denis.

swing@javadesktop.org wrote:
> please, can someone explain me if I should use java.awt.dnd package? why?
>
> I'm studying a lot and i'd like to create a good solution.
>
> Thanks in advance
> [Message sent by forum member 'lordcenzin' (lordcenzin)]
>
> http://forums.java.net/jive/thread.jspa?messageID=301912
>


sw1679

Posts: 1
Re: drag-n-drop panel to panel
Posted: Jul 29, 2009 10:04 AM   in response to: lordcenzin
 
  Click to reply to this thread Reply

Hi,

perhaps you may find this thread helpful:
The workaround works.

http://forums.sun.com/thread.jspa?threadID=5399702

bye

Thorsten




 XML java.net RSS