|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
java.lang.Objectjavax.swing.text.StringContent
public final class StringContent
AbstractDocument.Content 介面的一個實作,這是一個對相對於較小的文檔和/或除錯很有用的強制實作。它只能管理簡單字元陣列中的字元內容。而且其效率很低。
通常建議使用間隙緩衝區或拼湊表實作。此緩衝區無法擴展為大尺寸。
警告:此類別的已序列化物件與以後的 Swing 版本不相容。當前序列化支持適用於短期存儲或運行相同 Swing 版本的應用程序之間的 RMI。從 1.4 版本開始,已在 java.beans 套件中添加了支持所有 JavaBeansTM 長期存儲的功能。請參見 XMLEncoder。
| 建構子摘要 | |
|---|---|
StringContent()
創建新的 StringContent 物件。 |
|
StringContent(int initialLength)
創建具有指定初始大小的新 StringContent。 |
|
| 方法摘要 | |
|---|---|
Position |
createPosition(int offset)
在內容中創建一個位置,讓其追蹤隨內容的變化而進行的更改。 |
void |
getChars(int where,
int len,
Segment chars)
檢索內容的某一部分,where + len 必須 <= length() |
protected Vector |
getPositionsInRange(Vector v,
int offset,
int length)
返回一個套件含 UndoPosRef 實例的 Vector,其 Position 的範圍從 offset 到 offset + length。 |
String |
getString(int where,
int len)
檢索內容的某一部分,where + len 必須 <= length()。 |
UndoableEdit |
insertString(int where,
String str)
將字元串插入到內容中。 |
int |
length()
返回內容的長度。 |
UndoableEdit |
remove(int where,
int nitems)
移除部分內容,其中 where + nitems 必須 < length()。 |
protected void |
updateUndoPositions(Vector positions)
在 positions 處重新設置所有 UndoPosRef 實例的位置。 |
| 從類別 java.lang.Object 繼承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 建構子詳細資訊 |
|---|
public StringContent()
public StringContent(int initialLength)
initialLength - 初始大小| 方法詳細資訊 |
|---|
public int length()
AbstractDocument.Content 中的 lengthAbstractDocument.Content.length()
public UndoableEdit insertString(int where,
String str)
throws BadLocationException
AbstractDocument.Content 中的 insertStringwhere - 起始位置,該值 >= 0 且 < length()str - 要插入的非 null 字元串
BadLocationException - 如果指定位置無效AbstractDocument.Content.insertString(int, java.lang.String)
public UndoableEdit remove(int where,
int nitems)
throws BadLocationException
AbstractDocument.Content 中的 removewhere - 起始位置,該值 >= 0nitems - 要移除的字元數,該值 >= 0
BadLocationException - 如果指定位置無效AbstractDocument.Content.remove(int, int)
public String getString(int where,
int len)
throws BadLocationException
AbstractDocument.Content 中的 getStringwhere - 起始位置,該值 >= 0len - 要檢索的長度,該值 >= 0
BadLocationException - 如果指定位置無效AbstractDocument.Content.getString(int, int)
public void getChars(int where,
int len,
Segment chars)
throws BadLocationException
AbstractDocument.Content 中的 getCharswhere - 起始位置,該值 >= 0len - 要檢索的字元數,該值 >= 0chars - 要在其中返回字元的 Segment 物件
BadLocationException - 如果指定位置無效AbstractDocument.Content.getChars(int, int, javax.swing.text.Segment)
public Position createPosition(int offset)
throws BadLocationException
AbstractDocument.Content 中的 createPositionoffset - 所創建位置的偏移量,該值 >= 0
BadLocationException - 如果指定位置無效
protected Vector getPositionsInRange(Vector v,
int offset,
int length)
offset 到 offset + length。如果 v 不為 null,則在此處放置比對的 Position。返回具有結果 Position 的向量。
這裡指的是內部用法,通常不適合子類別。
v - 要使用的 Vector,其位置是向量為 null 時創建的新位置offset - 起始偏移量,該值 >= 0length - 長度,該值 >= 0
protected void updateUndoPositions(Vector positions)
positions 處重新設置所有 UndoPosRef 實例的位置。
這裡指的是內部用法,通常不適合子類別。
positions - 實例的位置
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
| 上一個類別 下一個類別 | 框架 無框架 | |||||||||
| 摘要: 巢狀 | 欄位 | 建構子 | 方法 | 詳細資訊: 欄位 | 建構子 | 方法 | |||||||||
版權所有 2008 Sun Microsystems, Inc. 保留所有權利。請遵守GNU General Public License, version 2 only。