Highlighter
public class AlignmentHighlighter extends AbstractHighlighter
listenerList
Constructor | Description |
---|---|
AlignmentHighlighter() |
Instantiates a AlignmentHighlighter with default alignment LEADING.
|
AlignmentHighlighter(int alignment) |
Instantiates a AlignmentHighlighter with the specified alignment.
|
AlignmentHighlighter(HighlightPredicate predicate) |
Instantiates a FontHighlighter with the given HighlightPredicate and default
horizontal alignement.
|
AlignmentHighlighter(HighlightPredicate predicate,
int alignment) |
Instantiates a FontHighlighter with the given HighlightPredicate and null Font.
|
Modifier and Type | Method | Description |
---|---|---|
protected boolean |
canHighlight(Component component,
ComponentAdapter adapter) |
Subclasses may override to further limit the highlighting based
on Highlighter state, f.i.
|
protected Component |
doHighlight(Component renderer,
ComponentAdapter adapter) |
Apply the highlights.
|
int |
getHorizontalAlignment() |
Returns the alignment which is applied.
|
void |
setHorizontalAlignment(int alignment) |
Sets the horizontal alignment to apply.
|
addChangeListener, areEqual, fireStateChanged, getChangeListeners, getHighlightPredicate, highlight, removeChangeListener, setHighlightPredicate
public AlignmentHighlighter()
public AlignmentHighlighter(int alignment)
alignment
- the horizontal alignment to use.IllegalArgumentException
- if not one of the constants allowed as horizontal alignment,
that is one of LEADING, LEFT, CENTER, RIGHT, TRAILINGpublic AlignmentHighlighter(HighlightPredicate predicate)
predicate
- the HighlightPredicate to use, may be null to default to ALWAYS.public AlignmentHighlighter(HighlightPredicate predicate, int alignment)
predicate
- the HighlightPredicate to use, may be null to default to ALWAYS.alignment
- the horizontal alignment to use.IllegalArgumentException
- if not one of the constants allowed as horizontal alignment,
that is one of LEADING, LEFT, CENTER, RIGHT, TRAILINGpublic int getHorizontalAlignment()
public void setHorizontalAlignment(int alignment)
alignment
- the horizontal alignment to setIllegalArgumentException
- if not one of the constants allowed as horizontal alignment,
that is one of LEADING, LEFT, CENTER, RIGHT, TRAILINGprotected Component doHighlight(Component renderer, ComponentAdapter adapter)
Implemented to set the horizontal alignement of the rendering component.
doHighlight
in class AbstractHighlighter
renderer
- the cell renderer component that is to be decoratedadapter
- the ComponentAdapter for this decorate operationAbstractHighlighter.highlight(Component, ComponentAdapter)
protected boolean canHighlight(Component component, ComponentAdapter adapter)
This implementation returns true always.
Implemented to return true for components of type JLabel, AbstractButton or JTextField, false otherwise.
canHighlight
in class AbstractHighlighter
Copyright © 2018. All rights reserved.