edu.sdsc.sirius.util
Class LimitedLengthDocument

java.lang.Object
  extended byjavax.swing.text.AbstractDocument
      extended byjavax.swing.text.PlainDocument
          extended byedu.sdsc.sirius.util.LimitedLengthDocument
All Implemented Interfaces:
javax.swing.text.Document, java.io.Serializable

public class LimitedLengthDocument
extends javax.swing.text.PlainDocument

This class implements a field with fixed length.

Author:
Oleksandr V. Buzko
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.text.AbstractDocument
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.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
LimitedLengthDocument(int maxLength)
          Contructor that creates a field with the specified maximum length.
 
Method Summary
 void insertString(int offs, java.lang.String str, javax.swing.text.AttributeSet a)
          Inserts a String in the field.
 int maxLength()
          Returns maximum length allowed by this field.
 
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

LimitedLengthDocument

public LimitedLengthDocument(int maxLength)
Contructor that creates a field with the specified maximum length.

Parameters:
maxLength - maximum length in characters
Method Detail

maxLength

public int maxLength()
Returns maximum length allowed by this field.


insertString

public void insertString(int offs,
                         java.lang.String str,
                         javax.swing.text.AttributeSet a)
                  throws javax.swing.text.BadLocationException
Inserts a String in the field.

Throws:
javax.swing.text.BadLocationException