Package kg.apc.jmeter.gui
Class IntegerInputVerifier
- java.lang.Object
-
- javax.swing.InputVerifier
-
- kg.apc.jmeter.gui.IntegerInputVerifier
-
public class IntegerInputVerifier extends javax.swing.InputVerifierVerifies whether text input via a JTextField is an integer that falls within a specified set of bounds.
-
-
Constructor Summary
Constructors Constructor Description IntegerInputVerifier(int min, int max, java.awt.Color background, java.awt.Color warningBackground)Initialize the input verifier with an integer range and background colors.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMax()intgetMin()booleanshouldYieldFocus(javax.swing.JComponent input)Verifies the input with the side effect that the background color ofinputtobackgroundif returnstrue, orwarningBackgroundotherwisebooleanverify(javax.swing.JComponent input)Verifies that the input's text value can be converted to an integer that is>= minand<=max.
-
-
-
Constructor Detail
-
IntegerInputVerifier
public IntegerInputVerifier(int min, int max, java.awt.Color background, java.awt.Color warningBackground)Initialize the input verifier with an integer range and background colors.- Parameters:
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 invalid
-
-
Method Detail
-
getMin
public int getMin()
-
getMax
public int getMax()
-
shouldYieldFocus
public boolean shouldYieldFocus(javax.swing.JComponent input)
Verifies the input with the side effect that the background color ofinputtobackgroundif returnstrue, orwarningBackgroundotherwise- Overrides:
shouldYieldFocusin classjavax.swing.InputVerifier- Parameters:
input- component- Returns:
- if input is valid
-
verify
public boolean verify(javax.swing.JComponent input)
Verifies that the input's text value can be converted to an integer that is>= minand<=max.- Specified by:
verifyin classjavax.swing.InputVerifier- Parameters:
input- a JTextField instance- Returns:
trueif an only if the text input contains a value that
-
-