com.vwp.swing.text
Class ExtendedDocument

java.lang.Object
  extended by javax.swing.text.AbstractDocument
      extended by javax.swing.text.PlainDocument
          extended by com.vwp.swing.text.ExtendedDocument
All Implemented Interfaces:
Serializable, Document

public class ExtendedDocument
extends PlainDocument

This class implements a document object which can be used to limit the maximum amount of characters a user can enter into a input field

See Also:
Serialized Form

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
 
Fields inherited from class javax.swing.text.PlainDocument
lineLimitAttribute, tabSizeAttribute
 
Fields inherited from class javax.swing.text.AbstractDocument
BidiElementName, ContentElementName, ElementNameAttribute, ParagraphElementName, SectionElementName
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
ExtendedDocument(Document document, int numChars)
          Constructs a new ExtendedDocument object
ExtendedDocument(int numChars)
          Constructs a new ExtendedDocument object
 
Method Summary
 void insertString(int offs, String str, AttributeSet a)
           
 
Methods inherited from class javax.swing.text.PlainDocument
getDefaultRootElement, getParagraphElement
 
Methods inherited from class javax.swing.text.AbstractDocument
addDocumentListener, addUndoableEditListener, createPosition, dump, getAsynchronousLoadPriority, getBidiRootElement, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, putProperty, readLock, readUnlock, remove, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtendedDocument

public ExtendedDocument(int numChars)
Constructs a new ExtendedDocument object

Parameters:
numChars - The maximum amount of characters after that all additional input is ignored until the already stored number of characters is decreased.

ExtendedDocument

public ExtendedDocument(Document document,
                        int numChars)
Constructs a new ExtendedDocument object

Parameters:
document - A Document object to use within this ExtendedDocument
numChars - The maximum amount of characters after that all additional input is ignored until the already stored number of characters is decreased.
Method Detail

insertString

public void insertString(int offs,
                         String str,
                         AttributeSet a)
                  throws BadLocationException
Specified by:
insertString in interface Document
Overrides:
insertString in class PlainDocument
Throws:
BadLocationException