1

I'm following the example of JTreeTable filesystem2 taken from the sun site http://java.sun.com/products/jfc/tsc/articles/treetable2/index.html#updating_the My problem is that I can't update my model (and then my JTreeTable)... In fact I create my model, I pass it to the JTreeTable and all work fine...but I need to modify the model... I've yet answer a similar question, but now I've changed my code, without find a solution.

The problem is when and how I have to call the method fireTreeNodesChanged()...in the example above is used the method getPath() to retrieve information about the root node...but this is a method of File class..not my case...

Does anyone have a link to a simple code which shows how create a TreeTabelModel (with objects as nodes) and how update it?

marco
  • 295
  • 3
  • 13
  • dont quite understand what exactly is the problem. Whatever, note that the TreeTableModel _is-a_ TreeModel. So you can search for examples/tutorials about implemnting dynamic TreeModel/-implementations and do it similarly. BTW, SwingX has a JXTreeTable that's much improved compared to that oldish example above :-) – kleopatra Sep 03 '11 at 09:38

1 Answers1

1

FileBrowser is a good example of modeling a hierarchical file system as a tree. While its TreeModel is implemented using DefaultTreeModel, an alternative FileTreeModel is shown here. As mentioned in How to Use Trees: Creating a Data Model "the TreeModel interface accepts any kind of object as a tree node."

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045