How to insert/remove a new row(node) in a jXtreetable?

963 Views Asked by At

I'm trying to use JXTreeTable from the SwingLabs library org.jdesktop.swingx.JXTreeTable. I've a problem when I try to insert/remove a node into/from the table.

The fact is that I was expected to have a method that could fire the JXTreeTable when the data in its model change. But I didn't find anything like this. Could anyone tell me how to add or remove a node (parent or child) in a JXTreeTable?

PS: my model class extends AbstractTreeTableModel. I pass in its constructor a LinkedList and populate the JXTreeTable with the data contained in this List

1

There are 1 best solutions below

0
Carsten On BEST ANSWER

The AbstractTreeTableModel has a protected member variable modelSupport of the type TreeModelSupport, which offers you a variety of such event methods:

  • fireNewRoot()
  • fireTreeStructureChanged(TreePath)
  • firePathChanged(TreePath)
  • fireChildChanged(TreePath, int, Object)
  • fireChildrenChanged(TreePath, int[], Object[])
  • fireChildAdded(TreePath, int, Object)
  • fireChildRemoved(TreePath, int, Object)
  • fireChildrenAdded(TreePath, int[], Object[])
  • fireChildrenRemoved(TreePath, int[], Object[])
  • addTreeModelListener(TreeModelListener)
  • removeTreeModelListener(TreeModelListener)