如何设置“关闭” jCalendar中的所有toogle日按钮? [英] How to set "off" all the toogle day buttons in jCalendar?

查看:211
本文介绍了如何设置“关闭” jCalendar中的所有toogle日按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用toedter的jCalendar并在使用以下代码点击日期按钮时触发事件:

I'm using the toedter's jCalendar and triggering events when the day buttons are clicked using the following code:


  JDayChooser jdc = jCalendar.getDayChooser();
  jdc.addPropertyChangeListener("day", new PropertyChangeListener() {
       @Override
       public void propertyChange(PropertyChangeEvent e) {
           date = jCalendar.getDate();
           new AgendaFrame(date, user).setVisible(true);  
       } 
  }); 


当jCalendar启动时,按钮匹配当前日期已被按下,因此,我无法按此按钮进入我的议程框架。有什么想法可以解决这个问题吗?

The thing is that when jCalendar initiates, the button which matches the current date is already pressed and so, I'm unable to press it to go to my agenda frame. Any ideas to solve this?

推荐答案


事情就是当jCalendar启动时,匹配的按钮
当前日期已被按下,因此,我无法将其按到
转到我的议程框架。有什么想法可以解决这个问题吗?

The thing is that when jCalendar initiates, the button which matches the current date is already pressed and so, I'm unable to press it to go to my agenda frame. Any ideas to solve this?

要解决这个问题,你必须使用 setAlwaysFireDayProperty(boolean alwaysFire)方法设置此属性 true

To solve this problem you have to use setAlwaysFireDayProperty(boolean alwaysFire) method to set this property true:

JCalendar calendar = new JCalendar();        
JDayChooser dayChooser = calendar.getDayChooser();
dayChooser.setAlwaysFireDayProperty(true); // here is the key
dayChooser.addPropertyChangeListener("day", ...);

这样,如果你按某个按钮(例如,今天),无论是什么,都会触发属性事件按钮已被按下。

This way if you press some button (for instance, today) the property event will be fired regardless the button was already pressed.


public void setAlwaysFireDayProperty(boolean alwaysFire)

JDateChooser需要这样做。

this is needed for JDateChooser.

参数:

alwaysFire - 如果每天选择一天,则触发day属性。

alwaysFire - true, if day property shall be fired every time a day is chosen.

这篇关于如何设置“关闭” jCalendar中的所有toogle日按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆