Package com.explodingpixels.macwidgets
Class MacBadgeRenderer
- java.lang.Object
-
- com.explodingpixels.macwidgets.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.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.awt.Font
BADGE_FONT
protected java.awt.Color
fActiveUnselectedColor
protected java.awt.Color
fInactiveUnselectedColor
protected com.explodingpixels.macwidgets.MacBadgeRenderer.CustomJLabel
fLabel
protected boolean
fSelected
protected java.awt.Color
fSelectedColor
protected java.awt.Color
fTextColor
-
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 thisSourceListCountBadgeRenderer
.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.
-
-
-
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
-
-
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 thisSourceListCountBadgeRenderer
. The returnedJComponent
should be added to a container that will be displayed.- Returns:
- the user interface component representing this
SourceListCountBadgeRenderer
.
-
-