|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.4.2
javax.swing.text
|
Nested Class Summary |
Nested classes inherited from class javax.swing.text.AbstractDocument |
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement |
Field Summary | |
static String |
lineLimitAttribute
Name of the attribute that specifies the maximum length of a line, if there is a maximum length. |
static String |
tabSizeAttribute
Name of the attribute that specifies the tab size for tabs contained in the content. |
Fields inherited from class javax.swing.text.AbstractDocument |
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName |
Fields inherited from interface javax.swing.text.Document |
StreamDescriptionProperty, TitleProperty |
Constructor Summary | |
PlainDocument()
Constructs a plain text document. |
|
PlainDocument(AbstractDocument.Content c)
Constructs a plain text document. |
Method Summary | |
protected AbstractDocument.AbstractElement |
createDefaultRoot()
Creates the root element to be used to represent the default document structure. |
Element |
getDefaultRootElement()
Gets the default root element for the document model. |
Element |
getParagraphElement(int pos)
Get the paragraph element containing the given position. |
void |
insertString(int offs,
String str,
AttributeSet a)
Inserts some content into the document. |
protected void |
insertUpdate(AbstractDocument.DefaultDocumentEvent chng,
AttributeSet attr)
Updates document structure as a result of text insertion. |
protected void |
removeUpdate(AbstractDocument.DefaultDocumentEvent chng)
Updates any document structure as a result of text removal. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String tabSizeAttribute
public static final String lineLimitAttribute
Constructor Detail |
public PlainDocument()
GapContent
is constructed and set.
public PlainDocument(AbstractDocument.Content c)
c
- the container for the contentMethod Detail |
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException
This method is thread safe, although most Swing methods are not. Please see Threads and Swing for more information.
insertString
in interface Document
insertString
in class AbstractDocument
offs
- the starting offset >= 0str
- the string to insert; does nothing with null/empty stringsa
- the attributes for the inserted content
BadLocationException
- the given insert position is not a valid
position within the documentDocument.insertString(int, java.lang.String, javax.swing.text.AttributeSet)
public Element getDefaultRootElement()
getDefaultRootElement
in interface Document
getDefaultRootElement
in class AbstractDocument
Document.getDefaultRootElement()
protected AbstractDocument.AbstractElement createDefaultRoot()
public Element getParagraphElement(int pos)
getParagraphElement
in class AbstractDocument
pos
- the starting offset >= 0
protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)
insertUpdate
in class AbstractDocument
chng
- the change event describing the ditattr
- the set of attributes for the inserted textprotected void removeUpdate(AbstractDocument.DefaultDocumentEvent chng)
removeUpdate
in class AbstractDocument
chng
- the change event describing the edit