public class LabelView extends GlyphViewimplements TabableView
LabelView is a styled chunk of text that represents a view mapped over an element in the text model. It caches the character level attributes used for rendering.
GlyphView.GlyphPainter BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXISBOTTOM, 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
Constructs a new view wrapped on an element.
|
| Modifier and Type | Method and Description |
|---|---|
void |
changedUpdate(DocumentEvent
Gives notification from the document that attributes were changed in a location that this view is responsible for.
|
Color |
getBackground()
Fetches the background color to use to render the glyphs.
|
Font |
getFont()
Fetches the font that the glyphs should be based upon.
|
protected FontMetrics |
getFontMetrics()
Deprecated.
FontMetrics are not used for glyph rendering when running in the JDK.
|
Color |
getForeground()
Fetches the foreground color to use to render the glyphs.
|
boolean |
isStrikeThrough()
Determines if the glyphs should have a strikethrough line.
|
boolean |
isSubscript()
Determines if the glyphs should be rendered as superscript.
|
boolean |
isSuperscript()
Determines if the glyphs should be rendered as subscript.
|
boolean |
isUnderline()
Determines if the glyphs should be underlined.
|
protected void |
setBackground(Color
Sets the background color for the view.
|
protected void |
setPropertiesFromAttributes()
Sets the cached properties from the attributes.
|
protected void |
setStrikeThrough(boolean s)
Sets whether or not the view has a strike/line through it.
|
protected void |
setSubscript(boolean s)
Sets whether or not the view represents a subscript.
|
protected void |
setSuperscript(boolean s)
Sets whether or not the view represents a superscript.
|
protected void |
setUnderline(boolean u)
Sets whether or not the view is underlined.
|
breakView, checkPainter, clone, createFragment, getAlignment, getBreakWeight, getEndOffset, getGlyphPainter, getMinimumSpan, getNextVisualPositionFrom, getPartialSpan, getPreferredSpan, getStartOffset, getTabbedSpan, getTabExpander, getText, insertUpdate, modelToView, paint, removeUpdate, setGlyphPainter, viewToModelappend, forwardUpdate, forwardUpdateToView, getAttributes, getChildAllocation, getContainer, getDocument, getElement, getGraphics, getMaximumSpan, getParent, getResizeWeight, getToolTipText, getView, getViewCount, getViewFactory, getViewIndex, getViewIndex, insert, isVisible, modelToView, modelToView, preferenceChanged, remove, removeAll, replace, setParent, setSize, updateChildren, updateLayout, viewToModelequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPartialSpan, getTabbedSpanpublic LabelView(Elementelem)
elem - the element
protected void setUnderline(boolean u)
u - true if the view is underlined, otherwise false
isUnderline()
protected void setStrikeThrough(boolean s)
s - true if the view has a strike/line through it, otherwise false
isStrikeThrough()
protected void setSuperscript(boolean s)
s - true if the view represents a superscript, otherwise false
isSuperscript()
protected void setSubscript(boolean s)
s - true if the view represents a subscript, otherwise false
isSubscript()
protected void setBackground(Colorbg)
View. If you need to customize the background color you should override
setPropertiesFromAttributes and invoke this method. A value of null indicates no background should be rendered, so that the background of the parent
View will show through.
bg - background color, or null
setPropertiesFromAttributes()
protected void setPropertiesFromAttributes()
@Deprecated protected FontMetricsgetFontMetrics()
FontMetrics used for this view.
public ColorgetBackground()
null.
getBackground in class
GlyphView
public ColorgetForeground()
null.
getForeground in class
GlyphView
public FontgetFont()
public boolean isUnderline()
When you request this property, LabelView re-syncs its state with the properties of the Element's AttributeSet. If Element's AttributeSet does not have this property set, it will revert to false.
isUnderline in class
GlyphView
underline property
public boolean isStrikeThrough()
strikeThrough property.
When you request this property, LabelView re-syncs its state with the properties of the Element's AttributeSet. If Element's AttributeSet does not have this property set, it will revert to false.
isStrikeThrough in class
GlyphView
strikeThrough property
public boolean isSubscript()
isSubscript in class
GlyphView
When you request this property, LabelView re-syncs its state with the properties of the Element's AttributeSet. If Element's AttributeSet does not have this property set, it will revert to false.
public boolean isSuperscript()
When you request this property, LabelView re-syncs its state with the properties of the Element's AttributeSet. If Element's AttributeSet does not have this property set, it will revert to false.
isSuperscript in class
GlyphView
superscript property
public void changedUpdate(DocumentEvente, Shape a, ViewFactory f)
changedUpdate in class
GlyphView
e - the change information from the associated document
a - the current allocation of the view
f - the factory to use to rebuild if the view has children
View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)