|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.text.View javax.swing.text.GlyphView javax.swing.text.LabelView
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 inherited from class javax.swing.text.GlyphView |
GlyphView.GlyphPainter |
Field Summary | |
private Color |
bg
|
private Color |
fg
|
private Font |
font
|
private boolean |
strike
|
private boolean |
subscript
|
private boolean |
superscript
|
private boolean |
underline
|
Fields inherited from class javax.swing.text.GlyphView |
defaultPainter, expander, length, offset, painter, x |
Fields inherited from class javax.swing.text.View |
BadBreakWeight, ExcellentBreakWeight, ForcedBreakWeight, GoodBreakWeight, sharedBiasReturn, X_AXIS, Y_AXIS |
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
Constructor Summary | |
LabelView(Element elem)
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 |
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 Java2 SDK. |
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 |
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. |
(package private) void |
sync()
Synchronize the view's cached values with the model. |
Methods inherited from class javax.swing.text.GlyphView |
breakView, checkPainter, clone, createFragment, getAlignment, getBreakWeight, getEndOffset, getGlyphPainter, getNextVisualPositionFrom, getPartialSpan, getPreferredSpan, getStartOffset, getTabbedSpan, getTabExpander, getText, insertUpdate, modelToView, paint, paintTextUsingColor, removeUpdate, setGlyphPainter, viewToModel |
Methods inherited from class javax.swing.text.View |
append, 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 |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.swing.text.TabableView |
getPartialSpan, getTabbedSpan |
Field Detail |
private Font font
private Color fg
private Color bg
private boolean underline
private boolean strike
private boolean superscript
private boolean subscript
Constructor Detail |
public LabelView(Element elem)
elem
- the elementMethod Detail |
final void sync()
protected void setUnderline(boolean u)
u
- true if the view is underlined, otherwise
falseisUnderline()
protected void setStrikeThrough(boolean s)
s
- true if the view has a strike/line
through it, otherwise falseisStrikeThrough()
protected void setSuperscript(boolean s)
s
- true if the view represents a
superscript, otherwise falseisSuperscript()
protected void setSubscript(boolean s)
s
- true if the view represents a
subscript, otherwise falseisSubscript()
protected void setPropertiesFromAttributes()
protected FontMetrics getFontMetrics()
FontMetrics
used for this view.
public Color getBackground()
null
.
getBackground
in class GlyphView
public Color getForeground()
null
.
getForeground
in class GlyphView
public Font getFont()
getFont
in class GlyphView
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
propertypublic 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 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 childrenView.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |