- java.lang.Object
-
- javax.swing.text.AbstractDocument.AbstractElement
-
- javax.swing.text.AbstractDocument.LeafElement
-
- All Implemented Interfaces:
-
Serializable,AttributeSet,Element,MutableAttributeSet,TreeNode
- 已知直接子类:
-
HTMLDocument.RunElement
- Enclosing class:
- AbstractDocument
public class AbstractDocument.LeafElement extends AbstractDocument.AbstractElement
实现直接表示某种内容的元素。警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,支持所有JavaBeans的长期存储已被添加到
java.beans软件包中。 请参阅XMLEncoder。- 另请参见:
-
Element, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface javax.swing.text.AttributeSet
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute
-
-
Field Summary
-
Fields inherited from interface javax.swing.text.AttributeSet
NameAttribute, ResolveAttribute
-
-
构造方法摘要
构造方法 Constructor 描述 LeafElement(Element parent, AttributeSet a, int offs0, int offs1)构造一个表示文档内容(没有子项)的元素。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 Enumeration<TreeNode>children()作为一个Enumeration返回接收者的Enumeration。booleangetAllowsChildren()如果接收器允许孩子,则返回true。ElementgetElement(int index)获取一个子元素。intgetElementCount()返回子元素的数量。intgetElementIndex(int pos)获取最接近给定模型偏移量的子元素索引。intgetEndOffset()获取元素模型中的结束偏移量。StringgetName()获取元素名称。intgetStartOffset()获取元素模型中的起始偏移量。booleanisLeaf()检查元素是否是叶子。StringtoString()将元素转换为字符串。-
Methods inherited from 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
-
-
-
-
构造方法详细信息
-
LeafElement
public LeafElement(Element parent, AttributeSet a, int offs0, int offs1)
构造一个表示文档内容(没有子项)的元素。- 参数
-
parent- 父元素 -
a- 元素属性 -
offs0- 起始偏移量> = 0 -
offs1- 结束偏移量> = offs0 - 从以下版本开始:
- 1.4
-
-
方法详细信息
-
getStartOffset
public int getStartOffset()
获取元素模型中的起始偏移量。- Specified by:
-
getStartOffset在接口Element - Specified by:
-
getStartOffset在AbstractDocument.AbstractElement - 结果
- offset> = 0
- 另请参见:
-
Document,AbstractDocument
-
getEndOffset
public int getEndOffset()
获取元素模型中的结束偏移量。- Specified by:
-
getEndOffset在接口Element - Specified by:
-
getEndOffset在AbstractDocument.AbstractElement - 结果
- offset> = 0
- 另请参见:
-
Document,AbstractDocument
-
getName
public String getName()
获取元素名称。- Specified by:
-
getName接口Element - 重写:
-
getName在AbstractDocument.AbstractElement - 结果
- 名字
-
getElementIndex
public int getElementIndex(int pos)
获取最接近给定模型偏移量的子元素索引。- Specified by:
-
getElementIndex在接口Element - Specified by:
-
getElementIndex在AbstractDocument.AbstractElement - 参数
-
pos- offset> = 0 - 结果
- 元素索引> = 0
-
getElement
public Element getElement(int index)
获取一个子元素。- Specified by:
-
getElement在接口Element - Specified by:
-
getElement在AbstractDocument.AbstractElement - 参数
-
index- 子索引> = 0 && <getElementCount() - 结果
- 子元素
-
getElementCount
public int getElementCount()
返回子元素的数量。- Specified by:
-
getElementCount在接口Element - Specified by:
-
getElementCount在AbstractDocument.AbstractElement - 结果
- 孩子数> = 0
-
isLeaf
public boolean isLeaf()
检查元素是否是叶子。
-
getAllowsChildren
public boolean getAllowsChildren()
如果接收器允许孩子,则返回true。- Specified by:
-
getAllowsChildren在接口TreeNode - Specified by:
-
getAllowsChildren在AbstractDocument.AbstractElement - 结果
- 如果接收器允许孩子,则为true,否则为false
-
children
public Enumeration<TreeNode> children()
以Enumeration返回接收者的Enumeration。- Specified by:
-
children在接口TreeNode - Specified by:
-
children在AbstractDocument.AbstractElement - 结果
- 接收者的孩子
-
-