Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
2が欲しいTreeModels:2番目のルートはTreeModel最初のノードですTreeModel(したがって、2番目TreeModelは最初のサブツリーですTreeModel)。
TreeModels
TreeModel
TreeModelこれを複製してルートを変更することで、これを簡単に実行できると思います。ただし、クローンを作成する簡単な方法があるかどうかはわかりませんTreeModel。
インターフェイスのデフォルトの実装はTreeModelですDefaultTreeModel。これをここで簡単に使用して、サブツリー モデルをインスタンス化できます。
DefaultTreeModel
TreeModel main = ...; // parent and index have to be defined TreeNode node = (TreeNode)main.getChild(parent, index); TreeModel sub = new DefaultTreeModel(node);