my dog learned polymorphism*
The moose likes Swing / AWT / SWT and the fly likes Drag and Drop 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" Watch "Drag and Drop" New topic
Author

Drag and Drop

Jeremy Hooie
Ranch Hand

Joined: Aug 22, 2001
Posts: 38
I'm trying to perform Drag and Drop operations from a JTree to a JList, but when I move something from the tree to the list, I receive the class and a memory address instead of the value(javax.swing.tree.DefaultTreeSelectionModel xxxxxxx [[null, Parent, Node]@xxx]). DnD from JList to JList or JTextArea to JTextArea works fine. Any suggestions?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

When you drop the item from your tree, make sure you are dropping the data into a DefaultListModel, otherwise it will print the jargon you were speaking of.
Regards


GenRocket - Experts at Building Test Data
Jeremy Hooie
Ranch Hand

Joined: Aug 22, 2001
Posts: 38
Here's what I've got. The reference to the object is of type Object and I try to get the String interpretation of it.
public void addElement(Object s)
{
((DefaultListModel)getModel()).addElement(s.toString());
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Drag and Drop
 
Similar Threads
Drag and Drop
drag and drop in the same JList and more...
Drag and Drop from JList to JTree
JTrees Drag and Drop
Drag and Drop folder?