@Test public void testVerifyGreaterThanMax() throws Exception { int min = 0; int max = 100; IntegerInputVerifier verifier = new IntegerInputVerifier(min, max, background, warningBackground); JTextField input = new JTextField(Integer.toString(Integer.MAX_VALUE)); assertFalse(verifier.verify(input)); }
public boolean verify(JComponent input) { JTextField tf = (JTextField) input; try { int inputInt = Integer.parseInt(tf.getText()); return (inputInt >= min && inputInt <= max); } catch (NumberFormatException e) { return false; } }
IntegerInputVerifier extends InputVerifier { public boolean verify(JComponent input) { JTextField tf = (JTextField) input; try { int inputInt = Integer.parseInt(tf.getText()); return (inputInt >= min && inputInt <= max); } catch (NumberFormatException e) { return false; } } }
IntegerInputVerifier extends InputVerifier { public boolean verify(JComponent input) { JTextField tf = (JTextField) input; try { int inputInt = Integer.parseInt(tf.getText()); return (inputInt >= min && inputInt <= max); } catch (NumberFormatException e) { return false; } } IntegerInputVerifier(int min, int max, Color background, Color warningBackground); }
IntegerInputVerifier extends InputVerifier { public boolean verify(JComponent input) { JTextField tf = (JTextField) input; try { int inputInt = Integer.parseInt(tf.getText()); return (inputInt >= min && inputInt <= max); } catch (NumberFormatException e) { return false; } } IntegerInputVerifier(int min, int max, Color background, Color warningBackground); int getMin(); int getMax(); boolean shouldYieldFocus(JComponent input); boolean verify(JComponent input); }
IntegerInputVerifier extends InputVerifier { public boolean verify(JComponent input) { JTextField tf = (JTextField) input; try { int inputInt = Integer.parseInt(tf.getText()); return (inputInt >= min && inputInt <= max); } catch (NumberFormatException e) { return false; } } IntegerInputVerifier(int min, int max, Color background, Color warningBackground); int getMin(); int getMax(); boolean shouldYieldFocus(JComponent input); boolean verify(JComponent input);  }