public interface StyledDocument extends Document
StreamDescriptionProperty, TitleProperty
Modifier and Type | Method and Description |
---|---|
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)
设置段落属性。
|
addDocumentListener, addUndoableEditListener, createPosition, getDefaultRootElement, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, insertString, putProperty, remove, removeDocumentListener, removeUndoableEditListener, render
Style addStyle(String nm, Style parent)
nm
-该样式的名称(必须命名风格的集合中是唯一的)。如果样式是未命名的,则该名称可能为空,但调用方负责管理返回的引用作为一个未命名的样式无法获取名称。一位不愿透露姓名的风格可能像字符属性重写如风格运行发现是有用的。
parent
-父样式。这可能是空的,如果未指定的属性,不需要在其他一些风格解决。
void removeStyle(String nm)
nm
-风格的名字删除
void setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace)
offset
-变化> = 0开始
length
- > = 0的长度的变化
s
-非空属性的改变。定义的任何属性将被应用到给定范围的文本中。
replace
-指示是否以前的属性应该在新的属性设置清除。如果是真的,操作将完全取代以前的属性。如果是错误的,新的属性将与以前的属性合并。
void setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace)
offset
-变化> = 0开始
length
- > = 0的长度的变化
s
-非空属性的改变。定义的任何属性将被应用到给定范围的文本中。
replace
-指示是否以前的属性应该在新的属性被设置了。如果是真的,操作将完全取代以前的属性。如果是错误的,新的属性将与以前的属性合并。
void setLogicalStyle(int pos, Style s)
pos
-起始位置> = 0
s
-风格设置
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
-属性设置
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.