• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Drag and Drop

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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());
}
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!