List of utility methods to do JTextField Number
boolean | validateDoubleInput(Component parentComponent, JLabel label, JTextField textField, String valueDescription, String errorTitle, boolean positiveValue, boolean showMessage, boolean valid) Validate double input. label.setForeground(Color.BLACK); label.setToolTipText(null); if (textField.getText() == null || textField.getText().trim().equals("")) { if (showMessage) { JOptionPane.showMessageDialog(parentComponent, "You need to specify the " + valueDescription + ".", errorTitle, JOptionPane.WARNING_MESSAGE); valid = false; ... |
boolean | verifyNumber_geq(JTextField field, Long number) Returns true if the number in field is greater or equal the given number. boolean res; try { res = Long.parseLong(field.getText()) >= number; } catch (Exception ex) { res = false; JTextField tmp = new JTextField(); Border defaultBorder = tmp.getBorder(); ... |
boolean | within(javax.swing.JTextField input, double low, double high, Vector Check if the JTextField input is larger than x boolean ok = within(input, low, high); if (!ok) errMsgList.add(errMsg); return ok; |