java.lang.Object
javax.swing.text.AbstractDocument.AbstractElement
javax.swing.text.AbstractDocument.LeafElement
- 所有已实现的接口:
-
Serializable,AttributeSet,Element,MutableAttributeSet,TreeNode
- 直接已知的子类:
-
HTMLDocument.RunElement
- 封装类:
-
AbstractDocument
实现一个直接表示某种内容的元素。
警告: 该类的序列化对象将不兼容未来的Swing版本。当前的序列化支持适用于短期存储或在运行相同Swing版本的应用程序之间的RMI。从1.4开始,已将所有JavaBeans的长期存储支持添加到java.beans包中。请参见XMLEncoder。
- 参见:
-
Nested Class Summary
Nested classes/interfaces declared in interface javax.swing.text.AttributeSet
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute -
Field Summary
Fields declared in interface javax.swing.text.AttributeSet
NameAttribute, ResolveAttribute -
Constructor Summary
ConstructorsConstructorDescriptionLeafElement(Element parent, AttributeSet a, int offs0, int offs1) 构造一个表示文档内部内容(没有子元素)的元素。 -
Method Summary
Modifier and TypeMethodDescriptionchildren()返回接收者的子元素作为一个Enumeration。boolean如果接收者允许子元素,则返回true。getElement(int index) 获取一个子元素。int返回子元素的数量。intgetElementIndex(int pos) 获取给定模型偏移量最接近的子元素索引。int获取元素在模型中的结束偏移量。getName()获取元素名称。int获取元素在模型中的起始偏移量。booleanisLeaf()检查元素是否为叶子。toString()将元素转换为字符串。Methods declared in class javax.swing.text.AbstractDocument.AbstractElement
addAttribute, addAttributes, containsAttribute, containsAttributes, copyAttributes, dump, getAttribute, getAttributeCount, getAttributeNames, getAttributes, getChildAt, getChildCount, getDocument, getIndex, getParent, getParentElement, getResolveParent, isDefined, isEqual, removeAttribute, removeAttributes, removeAttributes, setResolveParent
-
Constructor Details
-
LeafElement
构造一个表示文档内部内容(没有子元素)的元素。- 参数:
-
parent- 父元素 -
a- 元素属性 -
offs0- 起始偏移量 >= 0 -
offs1- 结束偏移量 >= offs0 - 自1.4起:
- 1.4
-
-
Method Details
-
toString
将元素转换为字符串。 -
getStartOffset
public int getStartOffset()获取元素在模型中的起始偏移量。- 指定者:
-
getStartOffset在接口Element - 指定者:
-
getStartOffset在类AbstractDocument.AbstractElement - 返回:
- 偏移量 >= 0
- 参见:
-
getEndOffset
public int getEndOffset()获取元素在模型中的结束偏移量。- 指定者:
-
getEndOffset在接口Element - 指定者:
-
getEndOffset在类AbstractDocument.AbstractElement - 返回:
- 偏移量 >= 0
- 参见:
-
getName
获取元素名称。- 指定者:
-
getName在接口Element - 覆盖:
-
getName在类AbstractDocument.AbstractElement - 返回:
- 名称
-
getElementIndex
public int getElementIndex(int pos) 获取给定模型偏移量最接近的子元素索引。- 指定者:
-
getElementIndex在接口Element - 指定者:
-
getElementIndex在类AbstractDocument.AbstractElement - 参数:
-
pos- 偏移量 >= 0 - 返回:
- 元素索引 >= 0
-
getElement
获取一个子元素。- 指定者:
-
getElement在接口Element - 指定者:
-
getElement在类AbstractDocument.AbstractElement - 参数:
-
index- 子索引,>= 0 && < getElementCount() - 返回:
- 子元素
-
getElementCount
public int getElementCount()返回子元素的数量。- 指定者:
-
getElementCount在接口Element - 指定者:
-
getElementCount在类AbstractDocument.AbstractElement - 返回:
- 子元素数量 >= 0
-
isLeaf
public boolean isLeaf()检查元素是否为叶子。 -
getAllowsChildren
public boolean getAllowsChildren()如果接收者允许子元素,则返回true。- 指定者:
-
getAllowsChildren在接口TreeNode - 指定者:
-
getAllowsChildren在类AbstractDocument.AbstractElement - 返回:
- 如果接收者允许子元素则返回true,否则返回false
-
children
返回接收者的子元素作为一个Enumeration。- 指定者:
-
children在接口TreeNode - 指定者:
-
children在类AbstractDocument.AbstractElement - 返回:
- 接收者的子元素
-