Package com.gargoylesoftware.base.util
Class DocumentUtil.LengthLimitedDocument
java.lang.Object
com.gargoylesoftware.base.util.DocumentUtil.PassthroughDocument
com.gargoylesoftware.base.util.DocumentUtil.LengthLimitedDocument
- All Implemented Interfaces:
Document
- Enclosing class:
DocumentUtil
A wrapper document that prevents the user from typing more than
a specified number of characters.
-
Field Summary
FieldsFields inherited from interface javax.swing.text.Document
StreamDescriptionProperty, TitleProperty
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
insertString
(int offset, String string, 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
-
Field Details
-
maxLength_
private int maxLength_
-
-
Constructor Details
-
LengthLimitedDocument
Create an instance- Parameters:
document
- The document to wrapmaxLength
- The maximum number of characters that can be entered into this document
-
-
Method Details
-
insertString
public void insertString(int offset, String string, AttributeSet attributeSet) throws BadLocationException - Specified by:
insertString
in interfaceDocument
- Overrides:
insertString
in classDocumentUtil.PassthroughDocument
- Throws:
BadLocationException
-