public class PlainDocument extends AbstractDocument
デフォルトのコンテンツ記憶域管理は、ギャップ付きバッファーの実装 (GapContent) によって行われます。GapContent は、かなり大きなドキュメントの編集をサポートしており、隣接するまとまった領域に対する一般的な編集を効率よく処理できます。
警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースとの互換性がなくなる予定です。現在の直列化のサポートは、短期間の格納や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。1.4 以降、すべての JavaBeansTM 用の長期間の格納サポートが java.beans
パッケージに追加されています。XMLEncoder
を参照してください。
Document
, AbstractDocument
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement
修飾子と型 | フィールドと説明 |
---|---|
static String |
lineLimitAttribute
最大長がある場合、1 行の最大長を指定する属性の名前です。
|
static String |
tabSizeAttribute
コンテンツ内のタブのサイズを指定する属性の名前です。
|
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName
StreamDescriptionProperty, TitleProperty
コンストラクタと説明 |
---|
PlainDocument()
プレーンテキストドキュメントを構築します。
|
PlainDocument(AbstractDocument.Content c)
プレーンテキストドキュメントを構築します。
|
修飾子と型 | メソッドと説明 |
---|---|
protected AbstractDocument.AbstractElement |
createDefaultRoot()
デフォルトのドキュメント構造を表すために使うルート要素を作成します。
|
Element |
getDefaultRootElement()
ドキュメントモデルのデフォルトのルート要素を取得します。
|
Element |
getParagraphElement(int pos)
指定された位置を保持する段落要素を取得します。
|
void |
insertString(int offs, String str, AttributeSet a)
ドキュメントに内容を挿入します。
|
protected void |
insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)
ドキュメント構造をテキスト挿入の結果で更新します。
|
protected void |
removeUpdate(AbstractDocument.DefaultDocumentEvent chng)
ドキュメント構造をテキスト削除の結果で更新します。
|
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
public static final String tabSizeAttribute
public PlainDocument()
GapContent
を使うデフォルトモデルが構築されて、設定されます。public PlainDocument(AbstractDocument.Content c)
c
- コンテンツのコンテナpublic void insertString(int offs, String str, AttributeSet a) throws BadLocationException
このメソッドはスレッドセーフですが、ほとんどの Swing メソッドは違います。詳細は、「How to Use Threads」を参照してください。
insertString
、インタフェース: Document
insertString
、クラス: AbstractDocument
offs
- 開始オフセット >= 0str
- 挿入する文字列。null や空の文字列の場合は何もしないa
- 挿入されたコンテンツの属性BadLocationException
- 指定された挿入位置がドキュメント内の有効な位置でない場合Document.insertString(int, java.lang.String, javax.swing.text.AttributeSet)
public Element getDefaultRootElement()
getDefaultRootElement
、インタフェース: Document
getDefaultRootElement
、クラス: AbstractDocument
Document.getDefaultRootElement()
protected AbstractDocument.AbstractElement createDefaultRoot()
public Element getParagraphElement(int pos)
getParagraphElement
、クラス: AbstractDocument
pos
- 開始オフセット >= 0protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)
insertUpdate
、クラス: AbstractDocument
chng
- 編集を記述する変更イベントattr
- 挿入テキストの属性セットprotected void removeUpdate(AbstractDocument.DefaultDocumentEvent chng)
removeUpdate
、クラス: AbstractDocument
chng
- 編集を記述する変更イベント バグまたは機能を送信
詳細な API リファレンスおよび開発者ドキュメントについては、Java SE のドキュメントを参照してください。そのドキュメントには、概念的な概要、用語の定義、回避方法、有効なコード例などの、開発者を対象にしたより詳細な説明が含まれています。
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.