javax.swing.text

Class PlainDocument

public class PlainDocument extends AbstractDocument

A simple document class which maps lines to {@link Element}s.
Field Summary
static StringlineLimitAttribute
static StringtabSizeAttribute
Constructor Summary
PlainDocument()
PlainDocument(AbstractDocument.Content content)
Method Summary
protected AbstractDocument.AbstractElementcreateDefaultRoot()
ElementgetDefaultRootElement()
ElementgetParagraphElement(int pos)
voidinsertString(int offs, String str, AttributeSet atts)
Inserts a string into the document.
protected voidinsertUpdate(DefaultDocumentEvent event, AttributeSet attributes)
protected voidremoveUpdate(DefaultDocumentEvent event)

Field Detail

lineLimitAttribute

public static final String lineLimitAttribute

tabSizeAttribute

public static final String tabSizeAttribute

Constructor Detail

PlainDocument

public PlainDocument()

PlainDocument

public PlainDocument(AbstractDocument.Content content)

Method Detail

createDefaultRoot

protected AbstractDocument.AbstractElement createDefaultRoot()

getDefaultRootElement

public Element getDefaultRootElement()

getParagraphElement

public Element getParagraphElement(int pos)

insertString

public void insertString(int offs, String str, AttributeSet atts)
Inserts a string into the document. If the document property 'filterNewLines' is set to Boolean.TRUE, then all newlines in the inserted string are replaced by space characters, otherwise the superclasses behaviour is executed. Inserting content causes a write lock to be acquired during this method call.

Parameters: offs the offset at which to insert the string str the string to be inserted atts the text attributes of the string to be inserted

Throws: BadLocationException

insertUpdate

protected void insertUpdate(DefaultDocumentEvent event, AttributeSet attributes)

removeUpdate

protected void removeUpdate(DefaultDocumentEvent event)