FocusEvent
of で何らかの機能を実行したいJDatePicker
。を実装するために以下のコードを使用していますFocusListener
。
Properties p = new Properties();
p.put("text.today", "Today");
p.put("text.month", "Month");
p.put("text.year", "Year");
UtilDateModel model = new UtilDateModel();
Calendar today=Calendar.getInstance();
Date todayDate=new Date();
today.setTime(todayDate);
model.setDate(today.get(Calendar.YEAR), today.get(Calendar.MONTH), today.get(Calendar.DATE));
model.setSelected(true);
JDatePanelImpl datePanel =new JDatePanelImpl(model, p);
JDatePickerImpl datePicker = new JDatePickerImpl(datePanel,new DateLabelFormatter());
datePicker.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent e) {
// TODO Auto-generated method stub
System.out.println("fcus lost");
}
@Override
public void focusGained(FocusEvent e) {
// TODO Auto-generated method stub
System.out.println("focus gained");
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
//repaint();
displayImage(categoryAttributeObj,imGroupObj);
}
});
}
});
このコードは機能しません。このコードにエラーはありますか?