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
ConstructorsConstructorDescriptionNumberDocumentFilter(JTextComponent comp, boolean defaultZero) Create a filter for a text component. -
Method Summary
Modifier and TypeMethodDescriptionvoidremove(DocumentFilter.FilterBypass fb, int offset, int length) voidreplace(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:
replacein classDocumentFilter- Throws:
BadLocationException
-
remove
public void remove(DocumentFilter.FilterBypass fb, int offset, int length) throws BadLocationException - Overrides:
removein classDocumentFilter- Throws:
BadLocationException
-