JavaTM 2 Platform
Standard Ed. 6

javax.swing.text
类 DefaultStyledDocument.ElementSpec

java.lang.Object
  继承者 javax.swing.text.DefaultStyledDocument.ElementSpec
正在封闭类:
DefaultStyledDocument

public static class DefaultStyledDocument.ElementSpec
extends Object

构建元素的规范。

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


字段摘要
static short ContentType
          getType 的可能值。
static short EndTagType
          getType 的可能值。
static short JoinFractureDirection
          getDirection 的可能值。
static short JoinNextDirection
          getDirection 的可能值。
static short JoinPreviousDirection
          getDirection 的可能值。
static short OriginateDirection
          getDirection 的可能值。
static short StartTagType
          getType 的可能值。
 
构造方法摘要
DefaultStyledDocument.ElementSpec(AttributeSet a, short type)
          当标记不在文档中存储时供标记使用的构造方法。
DefaultStyledDocument.ElementSpec(AttributeSet a, short type, char[] txt, int offs, int len)
          用于外部创建规范的构造方法,供批量输入内容和标记到文档中。
DefaultStyledDocument.ElementSpec(AttributeSet a, short type, int len)
          供文档内部解析使用的构造方法,在数据已添加但还需要 len 信息时使用。
 
方法摘要
 char[] getArray()
          获得字符数组。
 AttributeSet getAttributes()
          获得元素属性。
 short getDirection()
          获得方向。
 int getLength()
          获得长度。
 int getOffset()
          获得起始偏移量。
 short getType()
          获得元素类型。
 void setDirection(short direction)
          设置方向。
 void setType(short type)
          设置元素类型。
 String toString()
          将元素转换为字符串。
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

StartTagType

public static final short StartTagType
getType 的可能值。它指定此记录类型为开始标记,同时表示指定元素开始的标记。

另请参见:
常量字段值

EndTagType

public static final short EndTagType
getType 的可能值。它指定此记录类型为结束标记,同时表示指定元素结束的标记。

另请参见:
常量字段值

ContentType

public static final short ContentType
getType 的可能值。它指定此记录类型表示内容。

另请参见:
常量字段值

JoinPreviousDirection

public static final short JoinPreviousDirection
getDirection 的可能值。它指定与此记录关联的数据应与位于它之前的元素连接。

另请参见:
常量字段值

JoinNextDirection

public static final short JoinNextDirection
getDirection 的可能值。它指定与此记录关联的数据应与跟随它的元素连接。

另请参见:
常量字段值

OriginateDirection

public static final short OriginateDirection
getDirection 的可能值。它指定与此记录关联的数据应用于生成新元素。这将是正常的值。

另请参见:
常量字段值

JoinFractureDirection

public static final short JoinFractureDirection
getDirection 的可能值。它指定与此记录关联的数据应与离散的元素连接。

另请参见:
常量字段值
构造方法详细信息

DefaultStyledDocument.ElementSpec

public DefaultStyledDocument.ElementSpec(AttributeSet a,
                                         short type)
当标记不在文档中存储时供标记使用的构造方法。

参数:
a - 元素的属性
type - 元素类型(StartTagType、EndTagType 和 ContentType)

DefaultStyledDocument.ElementSpec

public DefaultStyledDocument.ElementSpec(AttributeSet a,
                                         short type,
                                         int len)
供文档内部解析使用的构造方法,在数据已添加但还需要 len 信息时使用。

参数:
a - 元素的属性
type - 元素类型(StartTagType、EndTagType 和 ContentType)
len - 长度,该长度 >= 0

DefaultStyledDocument.ElementSpec

public DefaultStyledDocument.ElementSpec(AttributeSet a,
                                         short type,
                                         char[] txt,
                                         int offs,
                                         int len)
用于外部创建规范的构造方法,供批量输入内容和标记到文档中。

参数:
a - 元素的属性
type - 元素类型(StartTagType、EndTagType 和 ContentType)
txt - 元素的文本
offs - 文本偏移量,该偏移量 >= 0
len - 文本长度,该长度 >= 0
方法详细信息

setType

public void setType(short type)
设置元素类型。

参数:
type - 元素类型(StartTagType、EndTagType 和 ContentType)

getType

public short getType()
获得元素类型。

返回:
元素类型(StartTagType、EndTagType 和 ContentType)

setDirection

public void setDirection(short direction)
设置方向。

参数:
direction - 方向(JoinPreviousDirection、JoinNextDirection)

getDirection

public short getDirection()
获得方向。

返回:
方向(JoinPreviousDirection 和 JoinNextDirection)

getAttributes

public AttributeSet getAttributes()
获得元素属性。

返回:
属性集

getArray

public char[] getArray()
获得字符数组。

返回:
数组

getOffset

public int getOffset()
获得起始偏移量。

返回:
偏移量,该偏移量 >= 0

getLength

public int getLength()
获得长度。

返回:
长度,该长度 >= 0

toString

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

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

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

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