• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using Drag and drop with JLists to fire an event

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not very good with GUI programming yet, but what I would like to do is create an object that has a JList and be able to drag and drop from on instance of this list to another. In 1.4.1 this is really easy, just enable dnd in the JList. However, the default copy, link, move is not what I am after, what I would like is to be able to know that an element (say element 5) from one list (say list 2) has been dropped on another element (say element 3) of another list (say list 4) and have a method called (say myMethod(element5, list1, element3, list4) and NOT copy anything.

But I have no idea how to go about this, there are several DnD interfaces, but I am not sure which ones to implement and what methods I should override.

Any help would be greatly appreciated.


Currently I am extending JInternalFrames to house a JScrollPane that holds the JList, and I would really like to house all the methods in this one object, both the drag and the drop; if that makes any sense
 
reply
    Bookmark Topic Watch Topic
  • New Topic