• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Drag and Drop

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Jeremy Hooie
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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());
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic