private static final char[] ILLEGAL_CHARACTERS = { '/', '\n', '\r', '\t', '\0', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':' };
@Override
public ValidationResult validate(JTextComponent comp) {
ValidationResult result = new ValidationResult();
if (comp.getText().length()==0){
result.add(new SimpleValidationMessage("������ ������", Severity.ERROR, comp));
return result;
}
for(int i=0; i<comp.getText().length(); i++){
char ch = comp.getText().charAt(i);
for(int j=0; j<ILLEGAL_CHARACTERS.length; j++){
if (ch == ILLEGAL_CHARACTERS[j]){
result.add(new SimpleValidationMessage("������������ ������="+ch, Severity.ERROR, comp));
return result;
}
}
}
return result;