| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public class LabelView extends GlyphView implements TabableView
A 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 Summary |
---|
Nested classes/interfaces inherited from class javax.swing.text.GlyphView |
---|
GlyphView.GlyphPainter |
Field Summary |
---|
Fields inherited from class javax.swing.text.View |
---|
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, X_AXIS, Y_AXIS |
Constructor Summary | |
---|---|
Constructs a new view wrapped on an element. |
Method Summary | |
---|---|
void |
changedUpdate(DocumentEvent e, Shape a, ViewFactory f) Gives notification from the document that attributes were changed in a location that this view is responsible for. |
Color |
Fetches the background color to use to render the glyphs. |
Font |
getFont() Fetches the font that the glyphs should be based upon. |
protected FontMetrics |
Fetches the FontMetrics used for this view.
|
Color |
Fetches the foreground color to use to render the glyphs. |
boolean |
Determines if the glyphs should have a strikethrough line. |
boolean |
Determines if the glyphs should be rendered as superscript. |
boolean |
Determines if the glyphs should be rendered as subscript. |
boolean |
Determines if the glyphs should be underlined. |
protected void |
setBackground(Color bg) Sets the background color for the view. |
protected void |
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. |
Methods inherited from class javax.swing.text.GlyphView |
---|
breakView, changedUpdate, checkPainter, clone, createFragment, getAlignment, getBackground, getBreakWeight, getEndOffset, getFont, getForeground, getGlyphPainter, getNextVisualPositionFrom, getPartialSpan, getPreferredSpan, getStartOffset, getTabbedSpan, getTabExpander, getText, insertUpdate, isStrikeThrough, isSubscript, isSuperscript, isUnderline, modelToView, paint, removeUpdate, setGlyphPainter, viewToModel |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LabelView(Element elem)
elem
- the elementMethod Detail |
---|
public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
changedUpdate
in class GlyphView
e
- the change information from the associated documenta
- the current allocation of the viewf
- the factory to use to rebuild if the view has childrenpublic Color getBackground()
null
.
getBackground
in class GlyphView
public Font getFont()
getFont
in class GlyphView
protected FontMetrics getFontMetrics()
FontMetrics
used for this view.
public Color getForeground()
null
.
getForeground
in class GlyphView
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
propertypublic 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
propertypublic 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
propertyprotected void setBackground(Color bg)
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 nullprotected void setPropertiesFromAttributes()
protected void setStrikeThrough(boolean s)
s
- true if the view has a strike/line
through it, otherwise falseprotected void setSubscript(boolean s)
s
- true if the view represents a
subscript, otherwise falseprotected void setSuperscript(boolean s)
s
- true if the view represents a
superscript, otherwise falseprotected void setUnderline(boolean u)
u
- true if the view is underlined, otherwise
false
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |