Package games.stendhal.client.gui
Class NumberDocumentFilter
java.lang.Object
javax.swing.text.DocumentFilter
games.stendhal.client.gui.NumberDocumentFilter
Special document filter for editing number only content.
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.text.DocumentFilter
DocumentFilter.FilterBypass
-
Constructor Summary
ConstructorDescriptionNumberDocumentFilter(JTextComponent comp, boolean defaultZero)
Create a filter for a text component. -
Method Summary
Modifier and TypeMethodDescriptionvoid
remove(DocumentFilter.FilterBypass fb, int offset, int length)
void
replace(DocumentFilter.FilterBypass fb, int offset, int len, String str, AttributeSet a)
Methods inherited from class javax.swing.text.DocumentFilter
insertString
-
Constructor Details
-
NumberDocumentFilter
Create a filter for a text component.- Parameters:
comp
- text component. This is only used to highlight the "0" when the user deletes all other textdefaultZero
- iftrue
, then on clearing the document, a preselected 0 is inserted.
-
-
Method Details
-
replace
public void replace(DocumentFilter.FilterBypass fb, int offset, int len, String str, AttributeSet a) throws BadLocationException- Overrides:
replace
in classDocumentFilter
- Throws:
BadLocationException
-
remove
public void remove(DocumentFilter.FilterBypass fb, int offset, int length) throws BadLocationException- Overrides:
remove
in classDocumentFilter
- Throws:
BadLocationException
-