File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Drag and Drop" Watch "Drag and Drop" New topic

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: 15302

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.

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)
I agree. Here's the link:
subject: Drag and Drop
It's not a secret anymore!