public class PlainDocument extends AbstractDocument
デフォルトのコンテンツ記憶域管理は、ギャップ付きバッファの実装(GapContent)によって行われます。 これは、かなり大きなドキュメントの編集をサポートしており、隣接するまとまった領域に対する一般的な編集を効率よく処理できます。
警告: このクラスの直列化されたオブジェクトは、今後のSwingリリースとの互換性がなくなる予定です。 現在の直列化のサポートは、短期間の格納や、同じバージョンのSwingを実行するアプリケーション間のRMIに適しています。 1.4以降、すべてのJavaBeans™用の長期間の格納サポートが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メソッドは違います。 詳細は、Swingでの並行性に関連しているサイトを参照してください。
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, 2025, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Documentation Redistribution Policyも参照してください。