Class LabelView
- All Implemented Interfaces:
- Cloneable,- SwingConstants,- TabableView
- Direct Known Subclasses:
- InlineView
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.- 
Nested Class SummaryNested classes/interfaces declared in class javax.swing.text.GlyphViewGlyphView.GlyphPainter
- 
Field SummaryFields declared in class javax.swing.text.ViewBadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXISFields declared in interface javax.swing.SwingConstantsBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidchangedUpdate(DocumentEvent e, Shape a, ViewFactory f) Gives notification from the document that attributes were changed in a location that this view is responsible for.Fetches the background color to use to render the glyphs.getFont()Fetches the font that the glyphs should be based upon.protected FontMetricsDeprecated.FontMetrics are not used for glyph rendering when running in the JDK.Fetches the foreground color to use to render the glyphs.booleanDetermines if the glyphs should have a strikethrough line.booleanDetermines if the glyphs should be rendered as superscript.booleanDetermines if the glyphs should be rendered as subscript.booleanDetermines if the glyphs should be underlined.protected voidsetBackground(Color bg) Sets the background color for the view.protected voidSets the cached properties from the attributes.protected voidsetStrikeThrough(boolean s) Sets whether or not the view has a strike/line through it.protected voidsetSubscript(boolean s) Sets whether or not the view represents a subscript.protected voidsetSuperscript(boolean s) Sets whether or not the view represents a superscript.protected voidsetUnderline(boolean u) Sets whether or not the view is underlined.Methods declared in class javax.swing.text.GlyphViewbreakView, checkPainter, clone, createFragment, getAlignment, getBreakWeight, getEndOffset, getGlyphPainter, getMinimumSpan, getNextVisualPositionFrom, getPartialSpan, getPreferredSpan, getStartOffset, getTabbedSpan, getTabExpander, getText, insertUpdate, modelToView, paint, removeUpdate, setGlyphPainter, viewToModelMethods declared in class javax.swing.text.Viewappend, 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, viewToModelMethods declared in class java.lang.Objectequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface javax.swing.text.TabableViewgetPartialSpan, getTabbedSpan
- 
Constructor Details- 
LabelViewConstructs a new view wrapped on an element.- Parameters:
- elem- the element
 
 
- 
- 
Method Details- 
setUnderlineprotected void setUnderline(boolean u) Sets whether or not the view is underlined. Note that this setter is protected and is really only meant if you need to update some additional state when set.- Parameters:
- u- true if the view is underlined, otherwise false
- See Also:
 
- 
setStrikeThroughprotected void setStrikeThrough(boolean s) Sets whether or not the view has a strike/line through it. Note that this setter is protected and is really only meant if you need to update some additional state when set.- Parameters:
- s- true if the view has a strike/line through it, otherwise false
- See Also:
 
- 
setSuperscriptprotected void setSuperscript(boolean s) Sets whether or not the view represents a superscript. Note that this setter is protected and is really only meant if you need to update some additional state when set.- Parameters:
- s- true if the view represents a superscript, otherwise false
- See Also:
 
- 
setSubscriptprotected void setSubscript(boolean s) Sets whether or not the view represents a subscript. Note that this setter is protected and is really only meant if you need to update some additional state when set.- Parameters:
- s- true if the view represents a subscript, otherwise false
- See Also:
 
- 
setBackgroundSets the background color for the view. This method is typically invoked as part of configuring thisView. If you need to customize the background color you should overridesetPropertiesFromAttributesand invoke this method. A value of null indicates no background should be rendered, so that the background of the parentViewwill show through.- Parameters:
- bg- background color, or null
- Since:
- 1.5
- See Also:
 
- 
setPropertiesFromAttributesprotected void setPropertiesFromAttributes()Sets the cached properties from the attributes.
- 
getFontMetricsDeprecated.FontMetrics are not used for glyph rendering when running in the JDK.Fetches theFontMetricsused for this view.- Returns:
- the FontMetricsused for this view
 
- 
getBackgroundFetches the background color to use to render the glyphs. This is implemented to return a cached background color, which defaults tonull.- Overrides:
- getBackgroundin class- GlyphView
- Returns:
- the cached background color
- Since:
- 1.3
 
- 
getForegroundFetches the foreground color to use to render the glyphs. This is implemented to return a cached foreground color, which defaults tonull.- Overrides:
- getForegroundin class- GlyphView
- Returns:
- the cached foreground color
- Since:
- 1.3
 
- 
getFont
- 
isUnderlinepublic boolean isUnderline()Determines if the glyphs should be underlined. If true, an underline should be drawn through the baseline. This is implemented to return the cached underline property.When you request this property, LabelViewre-syncs its state with the properties of theElement'sAttributeSet. IfElement'sAttributeSetdoes not have this property set, it will revert to false.- Overrides:
- isUnderlinein class- GlyphView
- Returns:
- the value of the cached
     underlineproperty
- Since:
- 1.3
 
- 
isStrikeThroughpublic boolean isStrikeThrough()Determines if the glyphs should have a strikethrough line. If true, a line should be drawn through the center of the glyphs. This is implemented to return the cachedstrikeThroughproperty.When you request this property, LabelViewre-syncs its state with the properties of theElement'sAttributeSet. IfElement'sAttributeSetdoes not have this property set, it will revert to false.- Overrides:
- isStrikeThroughin class- GlyphView
- Returns:
- the value of the cached
     strikeThroughproperty
- Since:
- 1.3
 
- 
isSubscriptpublic boolean isSubscript()Determines if the glyphs should be rendered as superscript.When you request this property, LabelViewre-syncs its state with the properties of theElement'sAttributeSet. IfElement'sAttributeSetdoes not have this property set, it will revert to false.- Overrides:
- isSubscriptin class- GlyphView
- Returns:
- the value of the cached
     subscriptproperty
- Since:
- 1.3
 
- 
isSuperscriptpublic boolean isSuperscript()Determines if the glyphs should be rendered as subscript.When you request this property, LabelViewre-syncs its state with the properties of theElement'sAttributeSet. IfElement'sAttributeSetdoes not have this property set, it will revert to false.- Overrides:
- isSuperscriptin class- GlyphView
- Returns:
- the value of the cached
     superscriptproperty
- Since:
- 1.3
 
- 
changedUpdateGives notification from the document that attributes were changed in a location that this view is responsible for.- Overrides:
- changedUpdatein class- GlyphView
- Parameters:
- 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
- See Also:
 
 
-