Package ca.corbett.extras.dirtree
Class DirTreeNodeIcon
java.lang.Object
ca.corbett.extras.dirtree.DirTreeNodeIcon
- All Implemented Interfaces:
Icon
Shamelessly stolen from StackOverflow. Draws nice simple little + and - icons next to tree
nodes to indicate expand/collapse ability, instead of the horrible icons included
in every major look and feel.
To use this code, you have to let the UIManager know about it:
static {
UIManager.put("Tree.collapsedIcon", new DirTreeNodeIcon('+'));
UIManager.put("Tree.expandedIcon", new DirTreeNodeIcon('-'));
}
But a better option is to use LookAndFeelManager to switch the LookAndFeel to something better than one of the Java built-in defaults. Then you won't need this at all.
- Since:
- 2017-11-09
- Author:
- StackOverflow
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintvoid
-
Constructor Details
-
DirTreeNodeIcon
public DirTreeNodeIcon(char type)
-
-
Method Details
-
paintIcon
-
getIconWidth
public int getIconWidth()- Specified by:
getIconWidthin interfaceIcon
-
getIconHeight
public int getIconHeight()- Specified by:
getIconHeightin interfaceIcon
-