Java JTree Expand setExpandedIcon(JTree tree, Icon icon)

Here you can find the source of setExpandedIcon(JTree tree, Icon icon)

Description

Set's the expanded icon to use for the given JTree if that tree's UI delegate extends from BasicTreeUI .

License

Open Source License

Parameter

Parameter Description
tree the tree to set the expanded icon for.
icon the new collapsed icon to use.

Declaration

public static void setExpandedIcon(JTree tree, Icon icon) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import javax.swing.Icon;
import javax.swing.JTree;

import javax.swing.plaf.basic.BasicTreeUI;

public class Main {
    /**//from  ww w. j av  a2 s.c o m
     * Set's the expanded icon to use for the given {@link JTree} if that
     * tree's UI delegate extends from {@link BasicTreeUI}. If the given tree's
     * UI delegate does not extend from {@code BasicTreeUI} then the given
     * tree will not be changed.
     *
     * @param tree the tree to set the expanded icon for.
     * @param icon the new collapsed icon to use.
     * @see BasicTreeUI#setExpandedIcon(javax.swing.Icon)
     */
    public static void setExpandedIcon(JTree tree, Icon icon) {
        ((BasicTreeUI) tree.getUI()).setExpandedIcon(icon);
    }
}

Related

  1. getPaths(JTree tree, boolean expanded)
  2. getTreeSelectedExpandedIcon()
  3. isTreePathExpandable(TreeModel treeModel, TreePath treePath)
  4. makeTreeAutoExpandable(JTree tree)
  5. searchUnexpandedPath(JTree tree, TreePath path, int index, TreeNode node, TreePath[] result, boolean compareOnlyLabels)
  6. setExpandedOnEdt(JTree tree, TreePath path, boolean expanded)
  7. setExpandedPaths(JTree tree, TreePath[] expandedPaths)
  8. setFullyExpandedPath(JTree Target, TreeModel TheModel, Object Node, Vector Path)