Java JTextField isTelpValid(JTextField field)

Here you can find the source of isTelpValid(JTextField field)

Description

is Telp Valid

License

Apache License

Declaration

public static boolean isTelpValid(JTextField field) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.swing.JTextField;

public class Main {
    public static boolean isTelpValid(JTextField field) {
        boolean valid;
        String inputTelp = field.getText();
        String exp = "(^0[1-9]).{9,}";
        Pattern p = Pattern.compile(exp);
        Matcher m = p.matcher(inputTelp);
        if (m.matches()) {
            return valid = true;
        } else {/* w  w  w . j a va2 s.  c o  m*/
            return valid = false;
        }
    }
}

Related

  1. implyDisabled(final JCheckBox checked, final boolean checkedState, final JTextField changed)
  2. isActiveComponents(JTextField... textFields)
  3. isEmptyStr(javax.swing.JTextField input)
  4. isInHighlight(MouseEvent e, JTextField label, Highlighter h)
  5. isJTextFieldNotEmpty(javax.swing.JTextField field)
  6. IsTextFieldEmpty(javax.swing.JTextField tf)
  7. isTextFieldModified(JTextField textField, String originalValue)
  8. newIntegerValue(JTextField text, int oldValue)
  9. onTextFieldChange(JTextField field, final Runnable task)