jpiv2
Class VerifierInt

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

public class VerifierInt
extends javax.swing.InputVerifier

Integer verifier. Can be registered on an input component to verify user input.


Constructor Summary
VerifierInt()
          Creates a new instance of VerifierInt.
 
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

VerifierInt

public VerifierInt()
Creates a new instance of VerifierInt.

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]+$".

shouldYieldFocus

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

Overrides:
shouldYieldFocus in class javax.swing.InputVerifier
Parameters:
input - The input that needs to be verified.
Returns:
true if input is valid.