当前位置: 首页 > 工具软件 > JCalendar > 使用案例 >

java jcalendar_java – 将actionListener添加到jCalendar

林子石
2023-12-01

或者,您可以侦听特定的propertyName,“day”.

JDayChooser jdc = new JDayChooser();

jdc.addPropertyChangeListener("day", new PropertyChangeListener() {

@Override

public void propertyChange(PropertyChangeEvent e) {

System.out.println(e.getPropertyName()+ ": " + e.getNewValue());

}

});

附录:如何让它在JCalendar上工作?

同样,propertyName,“calendar”表示一个日历,您可以从中获取()DAY_OF_MONTH.

JCalendar jc = new JCalendar();

jc.addPropertyChangeListener("calendar", new PropertyChangeListener() {

@Override

public void propertyChange(PropertyChangeEvent e) {

final Calendar c = (Calendar) e.getNewValue();

System.out.println(c.get(Calendar.DAY_OF_MONTH));

}

});

 类似资料: