org.jtheque.utils.ui
Class DocumentLengthFilter
java.lang.Object
javax.swing.text.DocumentFilter
org.jtheque.utils.ui.DocumentLengthFilter
- Direct Known Subclasses:
- DocumentLengthFilterAvert
public class DocumentLengthFilter
- extends DocumentFilter
A document filter used to limit the length of a field.
- Author:
- Baptiste Wicht
Constructor Summary |
DocumentLengthFilter()
Construct a new DocumentLengthFilter with a default maximum number of characters. |
DocumentLengthFilter(int max)
Construct a new DocumentLengthFilter with a maximum number of characters. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DocumentLengthFilter
public DocumentLengthFilter()
- Construct a new
DocumentLengthFilter
with a default maximum number of characters. By default,
only 50 characters are accepted.
DocumentLengthFilter
public DocumentLengthFilter(int max)
- Construct a new
DocumentLengthFilter
with a maximum number of characters.
- Parameters:
max
- The maximum number of characters permitted in the document.
insertString
public final void insertString(DocumentFilter.FilterBypass fb,
int offset,
String str,
AttributeSet attrs)
throws BadLocationException
- Overrides:
insertString
in class DocumentFilter
- Throws:
BadLocationException
replace
public void replace(DocumentFilter.FilterBypass fb,
int offset,
int length,
String str,
AttributeSet attrs)
throws BadLocationException
- Overrides:
replace
in class DocumentFilter
- Throws:
BadLocationException
getMax
protected final int getMax()
- Return the maximum number of characters permitted in the document.
- Returns:
- The number.
Copyright © 2010 JTheque. All Rights Reserved.