Idea for DnD enhancement in Swing


Add mutable versions of the ListModel, TableModel and TreeModel interfaces to the Swing API. Enhance JList, JTable and JTree to support editing these mutable models.

The following basic editing facilities should be supported:

  • Editing (Changing) an element of the model.
  • Creating an element using an abstract factory.
  • Deleting an element.
  • Moving/Duplicating an element.
  • Cut/Copy/Paste clipboard operations as a means for moving/duplicating or deleting an element.
  • Drag and Drop operations as an alternative means for the clipboard operations.
  • Support leaf and composite elements.

Sample code

Download and run testdnd.jar for a demo of a MutableListModel and a DnDJList implementation prodiving the basic editing facilities as stated above except for leaf and composite elements.

Download and run testmutable.jar for a demo of a MutableTableModel and a MutableJTable implementation prodiving the basic editing facilities except drag and drop and leaf and composite elements.


All code shown here is copyright © Werner Randelshofer and may be used for evaluation purposes only.

© Werner Randelshofer. All rights reserved.