弊端拦截所有事件
package com.xherp.common.validate;
import java.awt.Component;
import javax.swing.InputVerifier;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
// This program demonstrates the use of the Swing InputVerifier class.
// It creates two text fields; the first of the text fields expects the
// string "pass" as input, and will allow focus to advance out of it
// only after that string is typed in by the user.
public class PassVerifier extends InputVerifier {
/**
*
* 逻辑连接或
*/
public static String OR="|";
/**
* 验证是否为空
*/
public static String VALIDATENULL = "^$";
/**
* 验证为正浮点数
*
* @param validateStr
* @return
*/
public static String VALIDATEFLOATNUMBER = "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$|^[1-9]\\d*";
/**
* 验证数字
*/
public static String VALIDATEDIGIT = "^[0-9]+$";
/**
* 验证中文字符
*/