Class DirTreeNodeIcon

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

@Deprecated(since="swing-extras 2.7", forRemoval=true) public class DirTreeNodeIcon extends Object implements Icon
Deprecated, for removal: This API element is subject to removal in a future version.
This class hasn't been used in ages, and LookAndFeelManager makes it unnecessary.
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
    Constructor
    Description
    DirTreeNodeIcon(char type)
    Deprecated, for removal: This API element is subject to removal in a future version.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    int
    Deprecated, for removal: This API element is subject to removal in a future version.
     
    void
    paintIcon(Component c, Graphics g, int x, int y)
    Deprecated, for removal: This API element is subject to removal in a future version.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DirTreeNodeIcon

      public DirTreeNodeIcon(char type)
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • paintIcon

      public void paintIcon(Component c, Graphics g, int x, int y)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      paintIcon in interface Icon
    • getIconWidth

      public int getIconWidth()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getIconWidth in interface Icon
    • getIconHeight

      public int getIconHeight()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Specified by:
      getIconHeight in interface Icon