模块 java.desktop

类 DefaultStyledDocument.ElementSpec

java.lang.Object
javax.swing.text.DefaultStyledDocument.ElementSpec
封闭类:
DefaultStyledDocument

public static class DefaultStyledDocument.ElementSpec extends Object
建筑构件规范。

Warning: 此类的序列化对象将与未来的 Swing 版本不兼容。当前的序列化支持适用于运行相同版本 Swing 的应用程序之间的短期存储或 RMI。从 1.4 开始,对所有 JavaBeans 的长期存储的支持已添加到 java.beans 包中。请参阅 XMLEncoder

  • 字段详细信息

    • 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 的可能值。这指定与此记录关联的数据应连接到断裂元素。
      参见:
  • 构造方法详细信息

    • ElementSpec

      public ElementSpec(AttributeSet  a, short type)
      当标记不存储在文档中时,构造方法对标记很有用。
      参数:
      a - 元素的属性
      type - 元素的类型(StartTagType、EndTagType、ContentType)
    • ElementSpec

      public ElementSpec(AttributeSet  a, short type, int len)
      当已经添加了数据但需要 len 信息时,用于在文档内部解析的构造方法。
      参数:
      a - 元素的属性
      type - 元素的类型(StartTagType、EndTagType、ContentType)
      len - 长度 >= 0
    • ElementSpec

      public 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()
      获取起始偏移量。
      返回:
      offset >= 0
    • getLength

      public int getLength()
      获取长度。
      返回:
      长度 >= 0
    • toString

      public String  toString()
      将元素转换为字符串。
      重写:
      toString 在类 Object
      返回:
      字符串