Package org.jdesktop.swingx.decorator
Class FontHighlighter
java.lang.Object
org.jdesktop.swingx.decorator.AbstractHighlighter
org.jdesktop.swingx.decorator.FontHighlighter
- All Implemented Interfaces:
Highlighter
A Highlighter which sets the Font of the component.
- Author:
- Karl George Schaefer
-
Field Summary
Fields inherited from class org.jdesktop.swingx.decorator.AbstractHighlighter
listenerList
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a FontHighlighter with null Font.FontHighlighter
(Font font) Instantiates a FontHighlighter with the given Font.FontHighlighter
(HighlightPredicate predicate) Instantiates a FontHighlighter with the given HighlightPredicate and null Font.FontHighlighter
(HighlightPredicate predicate, Font font) Instantiates a FontHighlighter with the given Font and HighlightPredicate. -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
canHighlight
(Component component, ComponentAdapter adapter) Subclasses may override to further limit the highlighting based on Highlighter state, f.i. a PainterHighlighter can only be applied to PainterAware components.protected Component
doHighlight
(Component component, ComponentAdapter adapter) Apply the highlights.getFont()
Returns the Font used for decoration.void
Sets the Font used for decoration.Methods inherited from class org.jdesktop.swingx.decorator.AbstractHighlighter
addChangeListener, areEqual, fireStateChanged, getChangeListeners, getHighlightPredicate, highlight, removeChangeListener, setHighlightPredicate
-
Constructor Details
-
FontHighlighter
public FontHighlighter()Instantiates a FontHighlighter with null Font. The Highlighter is applied always. -
FontHighlighter
Instantiates a FontHighlighter with the given Font. The Highlighter is applied always.- Parameters:
font
- the Font to apply
-
FontHighlighter
Instantiates a FontHighlighter with the given HighlightPredicate and null Font.- Parameters:
predicate
- the HighlightPredicate to use, may be null to default to ALWAYS.
-
FontHighlighter
Instantiates a FontHighlighter with the given Font and HighlightPredicate.- Parameters:
predicate
- the HighlightPredicate to use, may be null to default to ALWAYS.font
- the Font to apply, may be null
-
-
Method Details
-
getFont
Returns the Font used for decoration.- Returns:
- the Font used for decoration
- See Also:
-
setFont
Sets the Font used for decoration. May be null to not decorate.- Parameters:
font
- the Font used for decoration, may be null to not decorate.- See Also:
-
canHighlight
Subclasses may override to further limit the highlighting based on Highlighter state, f.i. a PainterHighlighter can only be applied to PainterAware components.This implementation returns true always.
Implemented to return false if the font property is null.
- Overrides:
canHighlight
in classAbstractHighlighter
- Parameters:
component
- the cell renderer component that is to be decoratedadapter
- a Component Adapter- Returns:
- a boolean indication if the adapter can be highlighted based general state. This implementation returns true always.
-
doHighlight
Apply the highlights.Implemented to set the component's Font.
- Specified by:
doHighlight
in classAbstractHighlighter
- Parameters:
component
- the cell renderer component that is to be decoratedadapter
- the ComponentAdapter for this decorate operation- Returns:
- Component
component
- See Also:
-