Java Utililty Methods JTextField Number

List of utility methods to do JTextField Number

Description

The list of methods to do JTextField Number are organized into topic(s).

Method

booleanvalidateDoubleInput(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;
...
booleanverifyNumber_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();
...
booleanwithin(javax.swing.JTextField input, double low, double high, Vector errMsgList, String errMsg)
Check if the JTextField input is larger than x
boolean ok = within(input, low, high);
if (!ok)
    errMsgList.add(errMsg);
return ok;