Package org.sm.smtools.swing.util
Class ANumberFilter
java.lang.Object
org.sm.smtools.swing.util.ANumberFilter
The
NumberFilter
class provides methods to validate the input in a JNumberInputField
.
Note that this is an abstract class.
- Version:
- 05/09/2014
- Author:
- Sven Maerivoet
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
validateDouble
(double d) Checks whether or not adouble
value is valid.abstract boolean
validateInteger
(int i) Checks whether or not anint
value is valid.
-
Constructor Details
-
ANumberFilter
public ANumberFilter()
-
-
Method Details
-
validateInteger
public abstract boolean validateInteger(int i) Checks whether or not anint
value is valid.A subclass must override this method, thereby specifying its own acceptable range for the
int
value. For example, to accept only strictly positive numbers, the following code can be used:return (i > 0);
- Parameters:
i
- theint
value to check- Returns:
true
when the specifiedint
value is accepted,false
otherwise
-
validateDouble
public abstract boolean validateDouble(double d) Checks whether or not adouble
value is valid.A subclass must override this method, thereby specifying its own acceptable range for the
double
value. For example, to accept only strictly positive numbers, the following code can be used:return (d > 0.0);
- Parameters:
d
- thedouble
value to check- Returns:
true
when the specifieddouble
value is accepted,false
otherwise
-