public static class JIntegerField.IntegerFilter extends DocumentFilter
DocumentFilter that only allows digits.DocumentFilter.FilterBypass| Constructor and Description |
|---|
IntegerFilter() |
| Modifier and Type | Method and Description |
|---|---|
void |
insertString(DocumentFilter.FilterBypass fb,
int offset,
String string,
AttributeSet attr)
String to be inserted into the Document.
|
void |
replace(DocumentFilter.FilterBypass fb,
int offset,
int length,
String string,
AttributeSet attrs)
String to be replaced with parts of the
Document. |
removepublic IntegerFilter()
public void insertString(DocumentFilter.FilterBypass fb, int offset, String string, AttributeSet attr) throws BadLocationException
Character.isDigit() will be accepted as a valid digit.insertString in class DocumentFilterfb - FilterBypassoffset - Insert offsetstring - String to be insertedattr - AttributeBadLocationException - Bad positionpublic void replace(DocumentFilter.FilterBypass fb, int offset, int length, String string, AttributeSet attrs) throws BadLocationException
Document. If it does not
contain digits only, the insertion will be refused and a beep will sound.
Everything matching Character.isDigit(char) will be accepted as a valid
digit.replace in class DocumentFilterfb - FilterBypassoffset - Replacement offsetlength - Length to be replacedstring - String to be replacedattrs - AttributeBadLocationException - Bad positionCopyright © 2004–2016. All rights reserved.