public class LabelView extends GlyphView implements TabableView
LabelView是一个风格的文本块,表示在文本模型中映射到元素上的视图。
它缓存用于渲染的字符级属性。
GlyphView.GlyphPainterBadBreakWeight, 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| Modifier and Type | Method and Description |
|---|---|
void |
changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
在该视图负责的位置向文档发出属性更改的通知。
|
Color |
getBackground()
获取用于渲染字形的背景颜色。
|
Font |
getFont()
获取字形应该基于的字体。
|
protected FontMetrics |
getFontMetrics()
已弃用
在JDK中运行时,FontMetrics不用于字形渲染。
|
Color |
getForeground()
获取用于渲染字形的前景色。
|
boolean |
isStrikeThrough()
确定字形是否应该有删除线。
|
boolean |
isSubscript()
确定字形是否应呈现为上标。
|
boolean |
isSuperscript()
确定字形是否应呈现为下标。
|
boolean |
isUnderline()
确定字形是否应加下划线。
|
protected void |
setBackground(Color bg)
设置视图的背景颜色。
|
protected void |
setPropertiesFromAttributes()
从属性设置缓存的属性。
|
protected void |
setStrikeThrough(boolean s)
设置视图是否具有打击/线条。
|
protected void |
setSubscript(boolean s)
设置视图是否表示下标。
|
protected void |
setSuperscript(boolean s)
设置视图是否代表上标。
|
protected void |
setUnderline(boolean u)
设置视图是否加下划线。
|
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(Element elem)
elem - 元素
protected void setUnderline(boolean u)
u - 如果视图带下划线,则为true,否则为false
isUnderline()
protected void setStrikeThrough(boolean s)
s - 如果视图具有罢工/线条,则为true,否则为false
isStrikeThrough()
protected void setSuperscript(boolean s)
s - 如果视图表示上标,则为true,否则为false
isSuperscript()
protected void setSubscript(boolean s)
s - 如果视图表示下标,则为true,否则为false
isSubscript()
protected void setBackground(Color bg)
View一部分进行调用。
如果您需要自定义背景颜色,您应该覆盖setPropertiesFromAttributes并调用此方法。
值为null表示不应呈现背景,以便父View将显示。
bg - 背景颜色,或null
setPropertiesFromAttributes()
protected void setPropertiesFromAttributes()
@Deprecated protected FontMetrics getFontMetrics()
FontMetrics 。
public Color getBackground()
null 。
getBackground在
GlyphView
public Color getForeground()
null 。
getForeground在
GlyphView
public boolean isUnderline()
当您请求此属性, LabelView重新同步与的性质及其状态Element的AttributeSet 。 如果Element的AttributeSet没有设置此属性,它将恢复为false。
isUnderline在
GlyphView
underline属性
public boolean isStrikeThrough()
strikeThrough属性。
当您请求此属性时, LabelView将重新同步其状态与Element的Element的AttributeSet 。 如果Element的AttributeSet没有设置此属性,它将恢复为false。
isStrikeThrough在
GlyphView
strikeThrough属性
public boolean isSubscript()
isSubscript在
GlyphView类
当您请求此属性, LabelView重新同步与的性质及其状态Element的AttributeSet 。 如果Element的AttributeSet没有设置此属性,它将恢复为false。
public boolean isSuperscript()
当您请求此属性时, LabelView重新同步其状态与Element的Element的AttributeSet 。 如果Element的AttributeSet没有设置此属性,它将恢复为false。
isSuperscript在
GlyphView
superscript属性
public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f)
changedUpdate在
GlyphView
e - 相关文件的变更信息
a - 视图的当前分配
f - 工厂使用重建如果视图有孩子
View.changedUpdate(javax.swing.event.DocumentEvent, java.awt.Shape, javax.swing.text.ViewFactory)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.