Java JTree Collapse collapseAllNodes(JTree tree)

Here you can find the source of collapseAllNodes(JTree tree)

Description

collapse All Nodes

License

LGPL

Declaration

public static void collapseAllNodes(JTree tree) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import javax.swing.JTree;

public class Main {
    public static void collapseAllNodes(JTree tree) {
        int row = tree.getRowCount() - 1;
        while (row >= 0) {
            tree.collapseRow(row);/*w w w .  j  a  v  a  2s .co  m*/
            row--;
        }
        tree.expandRow(0);
        row = tree.getRowCount() - 1;
        while (row >= 0) {
            tree.expandRow(row);
            row--;
        }
    }
}

Related

  1. collapseAll(JTree tree)
  2. collapseAllRows(JTree tree)
  3. collapseTree(JTree tree)
  4. collapseTree(JTree tree)
  5. fullSelectionCollapse(JTree tree)