我可以在日期验证器程序中的focusLost()中调用focusGained()吗?

时间:2017-04-23 13:02:23

标签: java swing date netbeans

如果可以,请告诉我。

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()。

0 个答案:

没有答案