how-to

Window (swing) applications

How to clear all items from JTree ?

For deleting all items in typical tree javax.swing.JTree use this techniques.

Create new empty DefaultTreeModel model with null param and set it to the tree.

jTree1.setModel( new DefaultTreeModel( null ) );