public final class StringContent extends Object implements AbstractDocument.Content, Serializable
通常建议使用间隙缓冲区或片表实现来代替。这个缓冲区不扩展到大尺寸。
警告:序列化该类的对象与以后的Swing版本不兼容。当前的序列化支持适用于短期贮藏或RMI运行相同Swing版本的应用程序之间。为1.4,为所有JavaBeans™长期存储的支持已被添加到java.beans包。请看XMLEncoder。
| Constructor and Description |
|---|
StringContent()
创建一个新的stringcontent对象。
|
StringContent(int initialLength)
创建一个新的stringcontent对象,指定的初始大小。
|
| Modifier and Type | Method and Description |
|---|---|
Position |
createPosition(int offset)
在内容被突变的内容中创建一个将跟踪更改的内容。
|
void |
getChars(int where, int len, Segment chars)
检索内容的一部分。
|
protected Vector |
getPositionsInRange(Vector v, int offset, int length)
返回一个向量,包含的范围
offset位置
offset +
length的undoposref实例。
|
String |
getString(int where, int len)
检索内容的一部分。
|
UndoableEdit |
insertString(int where, String str)
在内容中插入一个字符串。
|
int |
length()
返回内容的长度。
|
UndoableEdit |
remove(int where, int nitems)
删除内容的一部分。
|
protected void |
updateUndoPositions(Vector positions)
在
positions重置所有undoposref实例的位置。
|
public StringContent()
public StringContent(int initialLength)
initialLength -初始大小
public int length()
length 接口
AbstractDocument.Content
AbstractDocument.Content.length()
public UndoableEdit insertString(int where, String str) throws BadLocationException
insertString 接口
AbstractDocument.Content
where -起始位置>和< length() = 0
str -非空字符串插入
BadLocationException -如果指定的位置是无效的
AbstractDocument.Content.insertString(int, java.lang.String)
public UndoableEdit remove(int where, int nitems) throws BadLocationException
remove 接口
AbstractDocument.Content
where -起始位置> = 0
nitems -字符数删除> = 0
BadLocationException -如果指定的位置是无效的
AbstractDocument.Content.remove(int, int)
public String getString(int where, int len) throws BadLocationException
getString 接口
AbstractDocument.Content
where -起始位置> = 0
len长度-检索> = 0
BadLocationException -如果指定的位置是无效的
AbstractDocument.Content.getString(int, int)
public void getChars(int where,
int len,
Segment chars)
throws BadLocationException
getChars 接口
AbstractDocument.Content
where -起始位置> = 0
len -字符数检索> = 0
chars -段对象返回的字符
BadLocationException -如果指定的位置是无效的
AbstractDocument.Content.getChars(int, int, javax.swing.text.Segment)
public Position createPosition(int offset) throws BadLocationException
createPosition 接口
AbstractDocument.Content
offset -偏移创建> = 0的位置
BadLocationException -如果指定的位置是无效的
protected Vector getPositionsInRange(Vector v, int offset, int length)
offset位置
offset +
length。如果
v不是空的配合位置放在那里。返回的位置的向量。
这是为了内部使用,通常是不感兴趣的子类。
v的载体使用,以创建一个新的空
offset -起始偏移> = 0
length -长度> = 0
protected void updateUndoPositions(Vector positions)
positions重置所有undoposref实例的位置。
这是为了内部使用,通常是不感兴趣的子类。
positions -实例的位置
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.