Class GTreeRenderer

All Implemented Interfaces:
GComponent, ImageObserver, MenuContainer, Serializable, Accessible, SwingConstants, TreeCellRenderer

public class GTreeRenderer extends DefaultTreeCellRenderer implements GComponent
See Also:
  • Constructor Details

    • GTreeRenderer

      public GTreeRenderer()
  • Method Details

    • getTreeCellRendererComponent

      public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected1, boolean expanded, boolean leaf, int row, boolean hasFocus1)
      Specified by:
      getTreeCellRendererComponent in interface TreeCellRenderer
      Overrides:
      getTreeCellRendererComponent in class DefaultTreeCellRenderer
    • setBackgroundSelectionColor

      public void setBackgroundSelectionColor(Color newColor)
      Overrides this method to ensure that the new background selection color is not a GColorUIResource. Some Look and Feels will ignore color values that extend UIResource, choosing instead their own custom painting behavior. By not using a UIResource, we prevent the Look and Feel from overriding this renderer's color value.
      Overrides:
      setBackgroundSelectionColor in class DefaultTreeCellRenderer
      Parameters:
      newColor - the new background selection color
    • setBackgroundNonSelectionColor

      public void setBackgroundNonSelectionColor(Color newColor)
      Overrides this method to ensure that the new background non-selection color is not a GColorUIResource. Some Look and Feels will ignore color values that extend UIResource, choosing instead their own custom painting behavior. By not using a UIResource, we prevent the Look and Feel from overriding this renderer's color value.
      Overrides:
      setBackgroundNonSelectionColor in class DefaultTreeCellRenderer
      Parameters:
      newColor - the new background non-selection color
    • fromUiResource

      protected Color fromUiResource(Color color)
      Checks and converts any GColorUIResource to a GColor
      Parameters:
      color - the color to check if it is a UIResource
      Returns:
      either the given color or if it is a GColorUIResource, then a plain GColor instance referring to the same theme color property id.
    • updateIconTextGap

      protected void updateIconTextGap(Icon icon, int minWidth)
    • setIcon

      public void setIcon(Icon icon)
      Overrides:
      setIcon in class JLabel
    • getMinIconWidth

      public int getMinIconWidth()
    • setMinIconWidth

      public void setMinIconWidth(int minIconWidth)
    • getFont

      protected Font getFont(boolean bold)
    • getBackgroundNonSelectionColor

      public Color getBackgroundNonSelectionColor()
      Overrides:
      getBackgroundNonSelectionColor in class DefaultTreeCellRenderer
    • setRendererDropTarget

      public void setRendererDropTarget(Object target)