com.jmex.bui.text
Class IntegerDocument
java.lang.Object
com.jmex.bui.text.Document
com.jmex.bui.text.IntegerDocument
public class IntegerDocument
- extends Document
A document for use with a BTextField that allows only integer
numeric input. Note: to allow fully valid values to be entered one
character at a time, partially valid values (like the string '-' at position
zero) must be allowed. Thus one cannot rely on the integer document only
ever containing valid integers.
|
Field Summary |
protected boolean |
_positive
If true, only positive values are allowed. |
|
Constructor Summary |
IntegerDocument()
Creates a new document that allows any integer value. |
IntegerDocument(boolean positive)
Creates a new integer document. |
|
Method Summary |
protected boolean |
validateEdit(String oldText,
String newText)
Provides an opportunity for edits to be rejected before being applied to
the document. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_positive
protected boolean _positive
- If true, only positive values are allowed.
IntegerDocument
public IntegerDocument()
- Creates a new document that allows any integer value.
IntegerDocument
public IntegerDocument(boolean positive)
- Creates a new integer document.
- Parameters:
positive - if true, only accept positive values
validateEdit
protected boolean validateEdit(String oldText,
String newText)
- Description copied from class:
Document
- Provides an opportunity for edits to be rejected before being applied to
the document.
- Overrides:
validateEdit in class Document
- Returns:
- true if the document should be configured with the specified new
text, false if the old text should remain.
Copyright © 2008 Michael Bayne.
All Rights Reserved.