public class IntegerInputVerifier extends InputVerifier
Constructor and Description |
---|
IntegerInputVerifier(int min,
int max,
Color background,
Color warningBackground)
Initialize the input verifier with an integer range and background colors.
|
Modifier and Type | Method and Description |
---|---|
int |
getMax() |
int |
getMin() |
boolean |
shouldYieldFocus(JComponent input)
Verifies the input with the side effect that the background color of
input to background if
returns true , or warningBackground otherwise |
boolean |
verify(JComponent input)
Verifies that the input's text value can be converted to an integer that is
>= min and <=max . |
public IntegerInputVerifier(int min, int max, Color background, Color warningBackground)
min
- the minimum permissible integer valuemax
- the maximum permissible integer valuebackground
- the background color to set on the JComponent if the input is validwarningBackground
- the background color to set on the JComponent if the input is invalidpublic int getMin()
public int getMax()
public boolean shouldYieldFocus(JComponent input)
input
to background
if
returns true
, or warningBackground
otherwiseshouldYieldFocus
in class InputVerifier
input
- componentpublic boolean verify(JComponent input)
>= min
and <=max
.verify
in class InputVerifier
input
- a JTextField instancetrue
if an only if the text input contains a value thatCopyright © 2018. All rights reserved.