@Override
 public void replaceSelection(String text) {
   if (validate(text)) {
     super.replaceSelection(text);
   }
 }
 @Override
 public void replaceSelection(String text) {
   if (text.matches("[0-9]*")) {
     super.replaceSelection(text);
   }
 }