java.lang.Objectjavax.swing.text.AbstractDocument
javax.swing.text.PlainDocument
public class PlainDocument
A plain document that maintains no character attributes. The default element structure for this document is a map of the lines in the text. The Element returned by getDefaultRootElement is a map of the lines, and each child element represents a line. This model does not maintain any character level attributes, but each line can be tagged with an arbitrary set of attributes. Line to offset, and offset to line translations can be quickly performed using the default root element. The structure information of the DocumentEvent's fired by edits will indicate the line structure changes.
The default content storage management is performed by a gapped buffer implementation (GapContent). It supports editing reasonably large documents with good efficiency when the edits are contiguous or clustered, as is typical.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans package.
Please see XMLEncoder.
Document,
AbstractDocument| Nested Class Summary |
|---|
| Nested classes/interfaces 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 content| Method 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 DocumentinsertString in class AbstractDocumentoffs - 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 DocumentgetDefaultRootElement in class AbstractDocumentDocument.getDefaultRootElement()protected AbstractDocument.AbstractElement createDefaultRoot()
public Element getParagraphElement(int pos)
getParagraphElement in class AbstractDocumentpos - the starting offset >= 0
protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)
insertUpdate in class AbstractDocumentchng - the change event describing the ditattr - the set of attributes for the inserted textprotected void removeUpdate(AbstractDocument.DefaultDocumentEvent chng)
removeUpdate in class AbstractDocumentchng - the change event describing the editCes informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
6 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)