Here you can find the source of setCollapsedIcon(JTree tree, Icon icon)
Parameter | Description |
---|---|
tree | the tree to set the collapsed icon for. |
icon | the new collapsed icon to use. |
public static void setCollapsedIcon(JTree tree, Icon icon)
//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 a v a2 s .co m * Set's the collapsed icon to use for the given {@link JTree} if that * tree's UI delegate exetends 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 collapsed icon for. * @param icon the new collapsed icon to use. * @see BasicTreeUI#setCollapsedIcon(javax.swing.Icon) */ public static void setCollapsedIcon(JTree tree, Icon icon) { if (tree.getUI() instanceof BasicTreeUI) { ((BasicTreeUI) tree.getUI()).setCollapsedIcon(icon); } } }