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:
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
Fields Modifier and Type Field Description private int
maxLength_
-
Constructor Summary
Constructors Constructor Description LengthLimitedDocument(javax.swing.text.Document document, int maxLength)
Create an instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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
-
-
-
-
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 interfacejavax.swing.text.Document
- Overrides:
insertString
in classDocumentUtil.PassthroughDocument
- Throws:
javax.swing.text.BadLocationException
-
-