Here you can find the source of isTelpValid(JTextField field)
public static boolean isTelpValid(JTextField field)
//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; } } }