Expand/Collapse all JTree Nodes programatically

Can't imagine why this isn't already a part of the JTree:

    public void expandAllNodes()
    {
        int row = 0;
        while (row < getRowCount())
        {
            expandRow(row);
            row++;
        }
    }
    public void collapseAllNodes()
    {
        int row = getRowCount() - 1;
        while (row >= 0)
        {
            collapseRow(row);
            row--;
        }
    }
2/2/2008 | Comments (0) in Java
Email

Related posts