public class RangeVerifier
extends javax.swing.InputVerifier
Modifier and Type | Field and Description |
---|---|
static java.awt.Color |
ALERT_COLOR
The text color for text components containing out-of-range text.
|
static java.lang.String |
ID
Class identification name with source code version and date.
|
Constructor and Description |
---|
RangeVerifier(double min,
double max)
Creates a new RangeVerifier with the inclusive range from min to
max.
|
RangeVerifier(double min,
double max,
boolean allowBlanks)
Creates a new ranger verifier with the inclusive range from min to
max.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allowBlanks() |
void |
allowBlanks(boolean allowBlanks) |
double |
max() |
void |
max(double max) |
double |
min() |
void |
min(double min) |
boolean |
shouldYieldFocus(javax.swing.JComponent input)
Tests whether the component should yield focus.
|
boolean |
verify(javax.swing.JComponent input)
Verifies that the value for the component is within the allowed range.
|
public static final java.lang.String ID
public static final java.awt.Color ALERT_COLOR
public RangeVerifier(double min, double max, boolean allowBlanks)
min
- the minimum allowed value.max
- the maximum allowed value.allowBlanks
- if true, blanks are allowed in the input
to be verified.public RangeVerifier(double min, double max)
min
- the lowest allowed value.max
- the highest allowed value.public double min()
public void min(double min)
public double max()
public void max(double max)
public boolean allowBlanks()
public void allowBlanks(boolean allowBlanks)
public boolean verify(javax.swing.JComponent input)
JTextComponent
; if not, the
verification fails and the method returns false.verify
in class javax.swing.InputVerifier
input
- the test component.public boolean shouldYieldFocus(javax.swing.JComponent input)
ALERT_COLOR
and the system
beep sounds; if it should, the foreground color is set to null,
such that the component inherits its foreground color from its parent.
The test is conducted via a call to verify(javax.swing.JComponent)
.
shouldYieldFocus
in class javax.swing.InputVerifier
input
- the test component.Copyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona