如果可以,请告诉我。
catch (ParseException ex) {
jMessage.setText("Invalid Date. Input Date as DD/MM/YYYY");
//For Clearing Text Field On Click:
jDobTextField.addFocusListener(new FocusListener() {
@Override
public void focusGained(FocusEvent e) {
jMessage.setText("");
}
@Override
public void focusLost(FocusEvent e) {
//throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
focusGained(e);
}
});
}
我正在尝试在jFrame中添加dateValidator。我的问题是我可以在focusLost()中调用方法focusGained(e),重新启动整个过程,每次插入错误的日期并点击jTextField?
btw表示focusLost()是由netbeans生成的。我刚刚添加了focusGained()。