com.explodingpixels.macwidgets

## 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 Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static Font` | `BADGE_FONT`
    `protected Color` | `fActiveUnselectedColor`
    `protected Color` | `fInactiveUnselectedColor`
    `protected com.explodingpixels.macwidgets.MacBadgeRenderer.CustomJLabel` | `fLabel`
    `protected boolean` | `fSelected`
    `protected Color` | `fSelectedColor`
    `protected Color` | `fTextColor`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MacBadgeRenderer(Color selectedColor, Color activeUnselectedColor, Color inactiveUnselectedColor, Color textColor)` Creates a badge renderer.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `JComponent` | `getComponent()` Gets the user interface component to representing this `SourceListCountBadgeRenderer`.
    `void` | `setState(int count, boolean selected)` Sets the state to use when drawing the badge.
    `void` | `setState(String value, boolean selected)` Sets the state to use when drawing the badge.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### 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 Detail

    - #### MacBadgeRenderer

          public MacBadgeRenderer(Color selectedColor,
                          Color activeUnselectedColor,
                          Color inactiveUnselectedColor,
                          Color textColor)

      Creates a badge renderer.

  - ### Method Detail

    - #### 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`.