Class DirTreeNodeIcon

java.lang.Object
ca.corbett.extras.dirtree.DirTreeNodeIcon
All Implemented Interfaces:
Icon

public class DirTreeNodeIcon extends Object implements 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 Details

    • DirTreeNodeIcon

      public DirTreeNodeIcon(char type)
  • Method Details