Class MacBadgeRenderer

java.lang.Object
com.explodingpixels.macwidgets.MacBadgeRenderer
Direct Known Subclasses:
SourceListCountBadgeRenderer

public class MacBadgeRenderer extends Object
Renders a rounded rectangle (i.e. a badge) with a given number in the center of the rectangle.
  • Field Details

    • fLabel

      protected com.explodingpixels.macwidgets.MacBadgeRenderer.CustomJLabel fLabel
    • fSelected

      protected boolean fSelected
    • BADGE_FONT

      protected static Font BADGE_FONT
    • fSelectedColor

      protected final Color fSelectedColor
    • fActiveUnselectedColor

      protected final Color fActiveUnselectedColor
    • fInactiveUnselectedColor

      protected final Color fInactiveUnselectedColor
    • fTextColor

      protected final Color fTextColor
  • Constructor Details

    • MacBadgeRenderer

      public MacBadgeRenderer(Color selectedColor, Color activeUnselectedColor, Color inactiveUnselectedColor, Color textColor)
      Creates a badge renderer.
  • Method Details

    • setState

      public void setState(int count, boolean selected)
      Sets the state to use when drawing the badge.
      Parameters:
      count - the count value to draw in the center of the badge.
      selected - true if the badge should be rendered in a selected state.
    • setState

      public void setState(String value, boolean selected)
      Sets the state to use when drawing the badge.
      Parameters:
      value - the text value to draw in the center of the badge.
      selected - true if the badge should be rendered in a selected state.
    • getComponent

      public JComponent getComponent()
      Gets the user interface component to representing this SourceListCountBadgeRenderer. The returned JComponent should be added to a container that will be displayed.
      Returns:
      the user interface component representing this SourceListCountBadgeRenderer.