JavaTM 2 Platform
Standard Ed. 6

javax.swing.text
类 AbstractDocument.LeafElement

java.lang.Object
  继承者 javax.swing.text.AbstractDocument.AbstractElement
      继承者 javax.swing.text.AbstractDocument.LeafElement
所有已实现的接口:
Serializable, AttributeSet, Element, MutableAttributeSet, TreeNode
直接已知子类:
HTMLDocument.RunElement
正在封闭类:
AbstractDocument

public class AbstractDocument.LeafElement
extends AbstractDocument.AbstractElement

实现可直接表示某类内容的元素。

警告:此类的已序列化对象与以后的 Swing 版本不兼容。当前的序列化支持适用于短期存储或运行相同 Swing 版本的应用程序之间的 RMI。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder

另请参见:
Element

嵌套类摘要
 
从接口 javax.swing.text.AttributeSet 继承的嵌套类/接口
AttributeSet.CharacterAttribute, AttributeSet.ColorAttribute, AttributeSet.FontAttribute, AttributeSet.ParagraphAttribute
 
字段摘要
 
从接口 javax.swing.text.AttributeSet 继承的字段
NameAttribute, ResolveAttribute
 
构造方法摘要
AbstractDocument.LeafElement(Element parent, AttributeSet a, int offs0, int offs1)
          构造一个表示文档中内容的元素(没有子元素)。
 
方法摘要
 Enumeration children()
          以 Enumeration 的形式返回接收者的子级。
 boolean getAllowsChildren()
          如果接收者允许接收子元素,则返回 true。
 Element getElement(int index)
          获得一个子元素。
 int getElementCount()
          返回子元素的数量。
 int getElementIndex(int pos)
          获得与给定模型偏移量最接近的子元素索引。
 int getEndOffset()
          获得模型中该元素的结束偏移量。
 String getName()
          获得元素名。
 int getStartOffset()
          获得模型中该元素的起始偏移量。
 boolean isLeaf()
          检查该元素是否为叶元素。
 String toString()
          将该元素转换为字符串。
 
从类 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
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

AbstractDocument.LeafElement

public AbstractDocument.LeafElement(Element parent,
                                    AttributeSet a,
                                    int offs0,
                                    int offs1)
构造一个表示文档中内容的元素(没有子元素)。

参数:
parent - 父元素
a - 元素属性
offs0 - 起始偏移量,该偏移量 >= 0
offs1 - 结束偏移量,该偏移量 >= offs0
从以下版本开始:
1.4
方法详细信息

toString

public String toString()
将该元素转换为字符串。

覆盖:
Object 中的 toString
返回:
字符串

getStartOffset

public int getStartOffset()
获得模型中该元素的起始偏移量。

指定者:
接口 Element 中的 getStartOffset
指定者:
AbstractDocument.AbstractElement 中的 getStartOffset
返回:
偏移量,该偏移量 >= 0
另请参见:
Document, AbstractDocument

getEndOffset

public int getEndOffset()
获得模型中该元素的结束偏移量。

指定者:
接口 Element 中的 getEndOffset
指定者:
AbstractDocument.AbstractElement 中的 getEndOffset
返回:
偏移量,该偏移量 >= 0
另请参见:
Document, AbstractDocument

getName

public String getName()
获得元素名。

指定者:
接口 Element 中的 getName
覆盖:
AbstractDocument.AbstractElement 中的 getName
返回:
名称

getElementIndex

public int getElementIndex(int pos)
获得与给定模型偏移量最接近的子元素索引。

指定者:
接口 Element 中的 getElementIndex
指定者:
AbstractDocument.AbstractElement 中的 getElementIndex
参数:
pos - 偏移量,该偏移量 >= 0
返回:
元素索引,该索引 >= 0

getElement

public Element getElement(int index)
获得一个子元素。

指定者:
接口 Element 中的 getElement
指定者:
AbstractDocument.AbstractElement 中的 getElement
参数:
index - 子元素的索引,该索引 >= 0 && < getElementCount()
返回:
子元素

getElementCount

public int getElementCount()
返回子元素的数量。

指定者:
接口 Element 中的 getElementCount
指定者:
AbstractDocument.AbstractElement 中的 getElementCount
返回:
子元素的数量,该数量 >= 0

isLeaf

public boolean isLeaf()
检查该元素是否为叶元素。

指定者:
接口 Element 中的 isLeaf
指定者:
接口 TreeNode 中的 isLeaf
指定者:
AbstractDocument.AbstractElement 中的 isLeaf
返回:
如果为叶元素,则返回 true

getAllowsChildren

public boolean getAllowsChildren()
如果接收者允许接收子元素,则返回 true。

指定者:
接口 TreeNode 中的 getAllowsChildren
指定者:
AbstractDocument.AbstractElement 中的 getAllowsChildren
返回:
如果接收者允许接收子元素,则返回 true;否则返回 false

children

public Enumeration children()
Enumeration 的形式返回接收者的子级。

指定者:
接口 TreeNode 中的 children
指定者:
AbstractDocument.AbstractElement 中的 children
返回:
接收者的子级

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only