com.gargoylesoftware.base.util
Class DocumentUtil.LengthLimitedDocument

java.lang.Object
  extended by com.gargoylesoftware.base.util.DocumentUtil.PassthroughDocument
      extended by com.gargoylesoftware.base.util.DocumentUtil.LengthLimitedDocument
All Implemented Interfaces:
javax.swing.text.Document
Enclosing class:
DocumentUtil

private static class DocumentUtil.LengthLimitedDocument
extends DocumentUtil.PassthroughDocument

A wrapper document that prevents the user from typing more than a specified number of characters.


Field Summary
private  int maxLength_
           
 
Fields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
 
Constructor Summary
DocumentUtil.LengthLimitedDocument(javax.swing.text.Document document, int maxLength)
          Create an instance
 
Method Summary
 void insertString(int offset, java.lang.String string, javax.swing.text.AttributeSet attributeSet)
           
 
Methods inherited from class com.gargoylesoftware.base.util.DocumentUtil.PassthroughDocument
addDocumentListener, addUndoableEditListener, createPosition, getDefaultRootElement, getEndPosition, getLength, getProperty, getRootElements, getStartPosition, getText, getText, putProperty, remove, removeDocumentListener, removeUndoableEditListener, render
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxLength_

private int maxLength_
Constructor Detail

DocumentUtil.LengthLimitedDocument

public DocumentUtil.LengthLimitedDocument(javax.swing.text.Document document,
                                          int maxLength)
Create an instance

Parameters:
document - The document to wrap
maxLength - The maximum number of characters that can be entered into this document
Method Detail

insertString

public void insertString(int offset,
                         java.lang.String string,
                         javax.swing.text.AttributeSet attributeSet)
                  throws javax.swing.text.BadLocationException
Specified by:
insertString in interface javax.swing.text.Document
Overrides:
insertString in class DocumentUtil.PassthroughDocument
Throws:
javax.swing.text.BadLocationException