gravsphcolldemo
Class DoubleInputVerifier
java.lang.Object
|
+--javax.swing.InputVerifier
|
+--gravsphcolldemo.DoubleInputVerifier
- public class DoubleInputVerifier
- extends javax.swing.InputVerifier
This is an InputVerifier object for swing JTextField objects that
verifies whether the value entered can be parsed as a double.
- Version:
- May 2001
- Author:
- Miklos Reiter
Method Summary |
boolean |
getAcceptEmpty()
Is the empty string accepted as a valid entry? |
void |
setAcceptEmpty(boolean emptyEntryAccepted)
Sets whether the empty string should be accepted as valid. |
boolean |
shouldYieldFocus(javax.swing.JComponent input)
Displays a message box complaining to the user and informing them
briefly of the format of a double, if the input is invalid, in
addition to calling the inherited method. |
boolean |
verify(javax.swing.JComponent input)
Casts the argument to a JTextField and tries to parse its text
as a double. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DoubleInputVerifier
public DoubleInputVerifier()
- Constructs a new DoubleInputVerifier object.
This verifier will accept the empty string as a valid entry.
DoubleInputVerifier
public DoubleInputVerifier(boolean emptyEntryAccepted)
- Constructs a new DoubleInputVerifier object.
getAcceptEmpty
public boolean getAcceptEmpty()
- Is the empty string accepted as a valid entry?
setAcceptEmpty
public void setAcceptEmpty(boolean emptyEntryAccepted)
- Sets whether the empty string should be accepted as valid.
shouldYieldFocus
public boolean shouldYieldFocus(javax.swing.JComponent input)
- Displays a message box complaining to the user and informing them
briefly of the format of a double, if the input is invalid, in
addition to calling the inherited method.
- Overrides:
shouldYieldFocus
in class javax.swing.InputVerifier
verify
public boolean verify(javax.swing.JComponent input)
- Casts the argument to a JTextField and tries to parse its text
as a double. Returns true if it succeeds, false otherwise.
- Overrides:
verify
in class javax.swing.InputVerifier