public class LabelView extends GlyphView
GlyphView
that caches the textattributes for most effective
rendering.GlyphView.GlyphPainter
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor and Description |
---|
LabelView(Element element)
Creates a new
GlyphView for the given Element . |
Modifier and Type | Method and Description |
---|---|
void |
changedUpdate(DocumentEvent e,
Shape a,
ViewFactory vf)
Receives notification when text attributes change in the chunk of
text that this view is responsible for.
|
Color |
getBackground()
Returns the background color for the glyphs.
|
Font |
getFont()
Returns the font for the glyphs.
|
protected FontMetrics |
getFontMetrics()
Deprecated.
this is not used anymore
|
Color |
getForeground()
Returns the foreground color for the glyphs.
|
boolean |
isStrikeThrough()
Returns
true if the glyphs are rendered strike-through,
false otherwise. |
boolean |
isSubscript()
Returns
true if the glyphs are rendered as subscript,
false otherwise. |
boolean |
isSuperscript()
Returns
true if the glyphs are rendered as superscript,
false otherwise. |
boolean |
isUnderline()
Returns
true if the glyphs are rendered underlined,
false otherwise. |
protected void |
setBackground(Color bg)
Sets the background color for the glyphs.
|
protected void |
setPropertiesFromAttributes()
Loads the properties of this label view from the element's text
attributes.
|
protected void |
setStrikeThrough(boolean flag)
Sets the strike-through flag.
|
protected void |
setSubscript(boolean flag)
Sets the subscript flag.
|
protected void |
setSuperscript(boolean flag)
Sets the superscript flag.
|
protected void |
setUnderline(boolean flag)
Sets the underline flag.
|
breakView, checkPainter, clone, createFragment, getAlignment, getBreakWeight, getEndOffset, getGlyphPainter, getNextVisualPositionFrom, getPartialSpan, getPreferredSpan, getStartOffset, getTabbedSpan, getTabExpander, getText, insertUpdate, modelToView, paint, removeUpdate, setGlyphPainter, viewToModel
append, dump, forwardUpdate, forwardUpdateToView, getAttributes, getChildAllocation, getContainer, getDocument, getElement, getGraphics, getMaximumSpan, getMinimumSpan, getParent, getResizeWeight, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, replace, setParent, setSize, updateChildren, updateLayout, viewToModel
protected void setPropertiesFromAttributes()
changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
methodpublic void changedUpdate(DocumentEvent e, Shape a, ViewFactory vf)
setPropertiesFromAttributes()
.changedUpdate
in class GlyphView
e
- the document eventa
- the allocation of this viewvf
- the view factory to use for creating new viewspublic Color getBackground()
getBackground
in class GlyphView
protected void setBackground(Color bg)
null
means the background of the parent view should shine through.bg
- the background to set or null
public Color getForeground()
getForeground
in class GlyphView
protected FontMetrics getFontMetrics()
public boolean isUnderline()
true
if the glyphs are rendered underlined,
false
otherwise.isUnderline
in class GlyphView
true
if the glyphs are rendered underlined,
false
otherwiseprotected void setUnderline(boolean flag)
flag
- true
if the glyphs are rendered underlined,
false
otherwisepublic boolean isSubscript()
true
if the glyphs are rendered as subscript,
false
otherwise.isSubscript
in class GlyphView
true
if the glyphs are rendered as subscript,
false
otherwiseprotected void setSubscript(boolean flag)
flag
- true
if the glyphs are rendered as subscript,
false
otherwisepublic boolean isSuperscript()
true
if the glyphs are rendered as superscript,
false
otherwise.isSuperscript
in class GlyphView
true
if the glyphs are rendered as superscript,
false
otherwiseprotected void setSuperscript(boolean flag)
flag
- true
if the glyphs are rendered as superscript,
false
otherwisepublic boolean isStrikeThrough()
true
if the glyphs are rendered strike-through,
false
otherwise.isStrikeThrough
in class GlyphView
true
if the glyphs are rendered strike-through,
false
otherwiseprotected void setStrikeThrough(boolean flag)
flag
- true
if the glyphs are rendered strike-through,
false
otherwise