| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
public interface StyledDocument
用作通用样式化文档的接口。
| 字段摘要 | 
|---|
| 从接口 javax.swing.text.Document 继承的字段 | 
|---|
| StreamDescriptionProperty, TitleProperty | 
| 方法摘要 | |
|---|---|
|  Style | addStyle(String nm,
         Style parent)向逻辑样式层次中添加新样式。 | 
|  Color | getBackground(AttributeSet attr)使用一个属性集并将其转换为一个背景色规范。 | 
|  Element | getCharacterElement(int pos)获取表示文档中给定偏移量处字符的元素。 | 
|  Font | getFont(AttributeSet attr)使用一个属性集并将其转换为字体规范。 | 
|  Color | getForeground(AttributeSet attr)使用一个属性集并将其转换成为一个前景色规范。 | 
|  Style | getLogicalStyle(int p)获取段落中给定位置的逻辑样式。 | 
|  Element | getParagraphElement(int pos)获取表示包含文档中给定偏移量的段落的元素。 | 
|  Style | getStyle(String nm)获取以前添加的指定样式。 | 
|  void | removeStyle(String nm)移除以前添加到文档中的指定样式。 | 
|  void | setCharacterAttributes(int offset,
                       int length,
                       AttributeSet s,
                       boolean replace)更改内容元素属性,该属性是用来给定文档中现有内容范围的。 | 
|  void | setLogicalStyle(int pos,
                Style s)设置给定位置的段落所用的逻辑样式。 | 
|  void | setParagraphAttributes(int offset,
                       int length,
                       AttributeSet s,
                       boolean replace)设置段落属性。 | 
| 方法详细信息 | 
|---|
Style addStyle(String nm,
               Style parent)
nm - 样式的名称(在命名样式集合中必须是惟一的)。如果样式未命名,则此名称可能为 null,但是调用者要负责管理返回的引用,因为未命名的样式不能通过其名称获取。未命名的样式可以用于诸如字符属性重写这样的情况(例如在样式运行中)。parent - 父样式。如果未指定的属性不需要以其他样式解析,则此值可以为 null。
void removeStyle(String nm)
nm - 要移除的样式的名称Style getStyle(String nm)
nm - 样式名称
void setCharacterAttributes(int offset,
                            int length,
                            AttributeSet s,
                            boolean replace)
offset - 开始更改处,该值 >= 0length - 更改的长度,该值 >= 0s - 要更改为的非 null 属性。任何定义的属性都将适用于此给定范围的文本。replace - 表示在设置新属性时是否清除以前的属性。如果为 true,此操作将完全替换以前的属性。如果为 false,新属性将与以前的属性合并。
void setParagraphAttributes(int offset,
                            int length,
                            AttributeSet s,
                            boolean replace)
offset - 开始更改处,该值 >= 0length - 更改的长度,该值 >= 0s - 要更改为的非 null 属性。任何定义的属性都将适用于此给定范围的文本。replace - 表示在设置新属性时是否清除以前的属性。如果为 true,此操作将完全替换以前的属性。如果为 false,新属性将与以前的属性合并。
void setLogicalStyle(int pos,
                     Style s)
pos - 开始位置,该值 >= 0s - 要设置的样式Style getLogicalStyle(int p)
p - 位置,该值 >= 0
Element getParagraphElement(int pos)
pos - 偏移量,该值 >= 0
Element getCharacterElement(int pos)
pos - 偏移量,该值 >= 0
Color getForeground(AttributeSet attr)
attr - 属性集
Color getBackground(AttributeSet attr)
attr - 属性集
Font getFont(AttributeSet attr)
attr - 属性集
| 
 | JavaTM Platform Standard Ed. 6 | |||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。