This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Drag and Drop functionality in UI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Drag and Drop functionality in UI" Watch "Drag and Drop functionality in UI" New topic
Author

Drag and Drop functionality in UI

Murali Narayanaswamy
Greenhorn

Joined: May 29, 2007
Posts: 24
I have a similar requirement like in Yahoo mail Beta where you can drag any object and drop to any folder.

How is it done and would greatly appreciate if I get any of your expert comments on this

Thanks much
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Yahoo's UI widgets are open source! You can use them or just see how they did it: http://developer.yahoo.com/yui/


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Based on the forum topic, I presume you're talking about a Swing implementation, not YUI's javascript/ajax.

I would pretty much say the same thing here that I posted 18 months ago. It's almost as easy as:

JList userMessageList = new JList(...);
Jlist userFolderList = new JList(...)
userMessageList.setTransferHandler(...); // pass a handler for the drag-out
userFolderList.setTransferHandler(...); // pass a handler for the drop-into

except you have to actually write the TransferHandlers. There are other ways to do it (DragGesture/DropTarget) but TransferHandlers should be easier to use.

Do take a look at the three notes I included in the other thread. They might be helpful.


bitguru blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Drag and Drop functionality in UI
 
Similar Threads
OCE, JEE 6 JSP and Servlets Developer
Passed SCWCD 1.5
Passed OCEJWCD 6 with 92%
SWT tool in WSAD
Feedback: Info for SCJP Tiger beta