Class MacBadgeRenderer

  • Direct Known Subclasses:
    SourceListCountBadgeRenderer

    public class MacBadgeRenderer
    extends java.lang.Object
    Renders a rounded rectangle (i.e. a badge) with a given number in the center of the rectangle.
    • Constructor Summary

      Constructors 
      Constructor Description
      MacBadgeRenderer​(java.awt.Color selectedColor, java.awt.Color activeUnselectedColor, java.awt.Color inactiveUnselectedColor, java.awt.Color textColor)
      Creates a badge renderer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.swing.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​(java.lang.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 java.awt.Font BADGE_FONT
      • fSelectedColor

        protected final java.awt.Color fSelectedColor
      • fActiveUnselectedColor

        protected final java.awt.Color fActiveUnselectedColor
      • fInactiveUnselectedColor

        protected final java.awt.Color fInactiveUnselectedColor
      • fTextColor

        protected final java.awt.Color fTextColor
    • Constructor Detail

      • MacBadgeRenderer

        public MacBadgeRenderer​(java.awt.Color selectedColor,
                                java.awt.Color activeUnselectedColor,
                                java.awt.Color inactiveUnselectedColor,
                                java.awt.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​(java.lang.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 javax.swing.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.