jpiv2
Class VerifierFloat

java.lang.Object
  extended by javax.swing.InputVerifier
      extended by jpiv2.VerifierFloat

public class VerifierFloat
extends javax.swing.InputVerifier

Float Verifier. Can be registered on an input component to verify user input.


Constructor Summary
VerifierFloat()
          Creates a new instance of VerifierFloat.
 
Method Summary
 boolean shouldYieldFocus(javax.swing.JComponent input)
          Calls the verify method.
 boolean verify(javax.swing.JComponent input)
          Checks the validity of a String typed into a JTextField.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VerifierFloat

public VerifierFloat()
Creates a new instance of VerifierFloat.

Method Detail

verify

public boolean verify(javax.swing.JComponent input)
Checks the validity of a String typed into a JTextField.

Specified by:
verify in class javax.swing.InputVerifier
Parameters:
input - A JTextField
Returns:
true if the String of the JTextField matches the regular expression "^-?[0-9]+\\.?[0-9]*$".

shouldYieldFocus

public boolean shouldYieldFocus(javax.swing.JComponent input)
Calls the verify method.

Overrides:
shouldYieldFocus in class javax.swing.InputVerifier
Parameters:
input - The input to verify.
Returns:
true if input is valid.