public void deleteSelectedNodes(){
  DefaultTreeModel model=(DefaultTreeModel)dataTree.getModel();
  TreePath[] selectedPaths=dataTree.getSelectionPaths();
  if (selectedPaths != null) {
    for (    TreePath selectedPath : selectedPaths) {
      DefaultMutableTreeNode node=(DefaultMutableTreeNode)selectedPath.getLastPathComponent();
      node.removeAllChildren();
      model.nodeStructureChanged(node);
      DefaultMutableTreeNode parent=(DefaultMutableTreeNode)node.getParent();
      if (parent != null) {
        parent.remove(node);
        model.nodeStructureChanged(parent);
      }
    }
  }
}

public void deleteSelectedNodes ( ) { DefaultTreeModel model = ( DefaultTreeModel ) dataTree . getModel ( ) ; TreePath [ ] selectedPaths = dataTree . getSelectionPaths ( ) ; if ( selectedPaths != null ) { for ( TreePath selectedPath : selectedPaths ) { DefaultMutableTreeNode node = ( DefaultMutableTreeNode ) selectedPath . getLastPathComponent ( ) ; node . removeAllChildren ( ) ; model . nodeStructureChanged ( node ) ; DefaultMutableTreeNode parent = ( DefaultMutableTreeNode ) node . getParent ( ) ; if ( parent != null ) { parent . remove ( node ) ; model . nodeStructureChanged ( parent ) ; } } } }
delete all the selected nodes
