Even if this functionality changes, I still think that DefaultTreeModel is
flawed.

DefaultTreeModel requires the roots to be instantiated for the model to
exist (it's part of the constructor). If you source your data from a
database and don't store the model in the session or as a singleton this
will cause unnecessary hits to the database. For example when expanding a
tree node, the model is required but the roots are not.

Luckily, TreeModel is an interface and DefaultTreeModel is optional. You
can use my LazyTreeModel or similar.

Reply via email to