public class AlignmentHighlighter extends AbstractHighlighter
Modifier and Type | Field and Description |
---|---|
private int |
alignment |
private static int |
defaultAlignment |
listenerList
Constructor and Description |
---|
AlignmentHighlighter()
Instantiates a AlignmentHighlighter with default alignment LEADING.
|
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.
|
AlignmentHighlighter(int alignment)
Instantiates a AlignmentHighlighter with the specified alignment.
|
Modifier and Type | Method and Description |
---|---|
protected 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.
|
private int |
checkHorizontalAlignment(int alignment)
Checks if the horizontal alignment is valid.
|
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
private static final int defaultAlignment
private int alignment
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, TRAILINGprivate int checkHorizontalAlignment(int alignment)
alignment
- the horizontal alignment to checkIllegalArgumentException
- 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
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses