is JTree Node Expanded - Java Swing

Java examples for Swing:JTree

Description

is JTree Node Expanded

Demo Code


//package com.java2s;

import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;

import javax.swing.tree.TreePath;

public class Main {
    public static boolean isNodeExpanded(JTree tree,
            DefaultMutableTreeNode node) {
        if (tree == null) {
            throw new NullPointerException("tree == null");
        }//  w  w  w.j a va  2s .c o  m
        if (node == null) {
            throw new NullPointerException("node == null");
        }
        return tree.isExpanded(new TreePath(node.getPath()));
    }
}

Related Tutorials