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| Modifier and Type | Field and Description | 
|---|---|
| static String | lineLimitAttribute
              如果有最大长度,则指定一行的最大长度的属性名称。 
             | 
| static String | tabSizeAttribute
              指定内容中包含的标签的标签大小的属性名称。 
             | 
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementNameStreamDescriptionProperty, TitleProperty| Constructor and Description | 
|---|
| PlainDocument()
              构造一个纯文本文档。 
             | 
| PlainDocument(AbstractDocument.Content c)
              构造一个纯文本文档。 
             | 
| Modifier and Type | Method and Description | 
|---|---|
| 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, writeUnlockpublic static final String tabSizeAttribute
public static final String lineLimitAttribute
public PlainDocument()
GapContent的默认模型。 
          public PlainDocument(AbstractDocument.Content c)
c - 容器的内容 
           public void insertString(int offs,
                         String str,
                         AttributeSet a)
                  throws BadLocationException 
          这种方法是线程安全的,尽管大多数Swing方法都不是。 请参阅Concurrency in Swing以获取更多信息。
insertString在界面 
            Document 
           insertString在 
            AbstractDocument 
           offs - 起始偏移量> = 0 
           str - 要插入的字符串; 
            对空/空字符串不做任何事情 
           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 - 起始偏移量> = 0 
           protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)
insertUpdate在 
            AbstractDocument 
           chng - 描述dit的更改事件 
           attr - 插入文本的属性集 
           protected void removeUpdate(AbstractDocument.DefaultDocumentEvent chng)
removeUpdate在 
            AbstractDocument 
           chng - 描述编辑的更改事件 
            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.