Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Drag and Drop functionality in UI

 
Murali Narayanaswamy
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yahoo's UI widgets are open source! You can use them or just see how they did it: http://developer.yahoo.com/yui/
 
Brian Cole
Author
Ranch Hand
Posts: 903
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic