Package com.explodingpixels.widgets
Class TreeUtils
- java.lang.Object
-
- com.explodingpixels.widgets.TreeUtils
-
public class TreeUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcollapsePathOnEdt(javax.swing.JTree tree, javax.swing.tree.TreePath path)static voidexpandPathOnEdt(javax.swing.JTree tree, javax.swing.tree.TreePath path)static voidinstallRootExpandingTreeModelListener(javax.swing.JTree tree)static voidrepaintSelection(javax.swing.JTree tree)Repaints the selection.static voidsetCollapsedIcon(javax.swing.JTree tree, javax.swing.Icon icon)Set's the collapsed icon to use for the givenJTreeif that tree's UI delegate exetends fromBasicTreeUI.static voidsetExpandedIcon(javax.swing.JTree tree, javax.swing.Icon icon)Set's the expanded icon to use for the givenJTreeif that tree's UI delegate extends fromBasicTreeUI.static voidsetExpandedOnEdt(javax.swing.JTree tree, javax.swing.tree.TreePath path, boolean expanded)static voidsetLeftChildIndent(javax.swing.JTree tree, int indent)Set's the left indent in pixels to use for the givenJTree's collapsed and expanded icon.static voidsetRightChildIndent(javax.swing.JTree tree, int indent)Set's the right indent in pixels to use for the givenJTree's collapsed and expanded icon.
-
-
-
Method Detail
-
setCollapsedIcon
public static void setCollapsedIcon(javax.swing.JTree tree, javax.swing.Icon icon)Set's the collapsed icon to use for the givenJTreeif that tree's UI delegate exetends fromBasicTreeUI. If the given tree's UI delegate does not extend fromBasicTreeUIthen the given tree will not be changed.- Parameters:
tree- the tree to set the collapsed icon for.icon- the new collapsed icon to use.- See Also:
BasicTreeUI.setCollapsedIcon(javax.swing.Icon)
-
setExpandedIcon
public static void setExpandedIcon(javax.swing.JTree tree, javax.swing.Icon icon)Set's the expanded icon to use for the givenJTreeif that tree's UI delegate extends fromBasicTreeUI. If the given tree's UI delegate does not extend fromBasicTreeUIthen the given tree will not be changed.- Parameters:
tree- the tree to set the expanded icon for.icon- the new collapsed icon to use.- See Also:
BasicTreeUI.setExpandedIcon(javax.swing.Icon)
-
setLeftChildIndent
public static void setLeftChildIndent(javax.swing.JTree tree, int indent)Set's the left indent in pixels to use for the givenJTree's collapsed and expanded icon. This value in conjuction with the right indent comprises the total amount of space that the collapsed and expanded icon draw into. If the given tree's UI delegate does not extend fromBasicTreeUIthen the given tree will not be changed.- Parameters:
tree- the tree to set the left indent for.indent- the new left indent in pixels.- See Also:
BasicTreeUI.setLeftChildIndent(int)
-
setRightChildIndent
public static void setRightChildIndent(javax.swing.JTree tree, int indent)Set's the right indent in pixels to use for the givenJTree's collapsed and expanded icon. This value in conjuction with the left indent comprises the total amount of space that the collapsed and expanded icon draw into. If the given tree's UI delegate does not extend fromBasicTreeUIthen the given tree will not be changed.- Parameters:
tree- the tree to set the right indent for.indent- the new left indent in pixels.- See Also:
BasicTreeUI.setRightChildIndent(int)
-
repaintSelection
public static void repaintSelection(javax.swing.JTree tree)
Repaints the selection. This allows the row selection to have a background color that changes based on the focus state of the component.- Parameters:
tree- theJTreeto repaint the selection of.
-
setExpandedOnEdt
public static void setExpandedOnEdt(javax.swing.JTree tree, javax.swing.tree.TreePath path, boolean expanded)
-
expandPathOnEdt
public static void expandPathOnEdt(javax.swing.JTree tree, javax.swing.tree.TreePath path)
-
collapsePathOnEdt
public static void collapsePathOnEdt(javax.swing.JTree tree, javax.swing.tree.TreePath path)
-
installRootExpandingTreeModelListener
public static void installRootExpandingTreeModelListener(javax.swing.JTree tree)
-
-