Java JTree Node RemoveChildren(DefaultMutableTreeNode node)

Here you can find the source of RemoveChildren(DefaultMutableTreeNode node)

Description

Remove Children

License

Open Source License

Declaration

public static void RemoveChildren(DefaultMutableTreeNode node) 

Method Source Code

//package com.java2s;
/**/*from   www. j av  a 2 s .  c  o  m*/
 * CEDP: Computer Evaluator for Dependability and Performance
 * This file is distributed under the University of Illinois Open Source
 * License. See LICENSE.TXT for details.
 */

import javax.swing.tree.DefaultMutableTreeNode;

public class Main {
    public static void RemoveChildren(DefaultMutableTreeNode node) {
        while (node.getChildCount() > 0) {
            RemoveChildren((DefaultMutableTreeNode) node.getFirstChild());
        }
        //System.out.println("" + node);
        node.removeFromParent();
    }
}

Related

  1. isReflectanceType(TreeNode productTypeNode, String type)
  2. listTree(TreeNode node, String prefix, String lineSeparator)
  3. printTree(final DefaultMutableTreeNode tree, final String indent)
  4. recursiveTreeNode(DefaultMutableTreeNode node)
  5. refreshNode(final JTree tree, final TreeNode node)
  6. searchForNode(TreeNode node, String query)
  7. setTreeSelectedNode(JTree tree, TreeNode node)
  8. sort(DefaultMutableTreeNode node)
  9. sortNode(DefaultMutableTreeNode parent, Comparator comparator)