57186

How to set “off” all the toogle day buttons in jCalendar?

Question:

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

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

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?

Answer1:

<blockquote>

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?

</blockquote>

To solve this problem you have to use <a href="http://max-server.myftp.org/jcalendar/ibuild/dist/doc/api/com/toedter/calendar/JDayChooser.html#setAlwaysFireDayProperty%28boolean%29" rel="nofollow">setAlwaysFireDayProperty(boolean alwaysFire)</a> 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.

<blockquote> public void setAlwaysFireDayProperty(boolean alwaysFire)

this is needed for JDateChooser.

Parameters:

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

</blockquote>

Recommend

  • JCalendar getting date
  • How can I run the interval on my webpage only once? (jquery)
  • Opening Selenium Webdriver tests in the same window
  • iOS any way to cancel all network requests
  • Make a call and play a message? (Android 1.6)
  • WCF Impersonation and SQL trusted connections?
  • Is it possible to “capture funds” for authorized credit card transactions via the API?
  • Image onclick download image javascript/jquery
  • svn commit without -m
  • HBase with Kerberos - keep a HTable instance open more than 10 hours
  • Can a bootstrap carousel rotate through only some of the slides?
  • Async NSURLConnection and keep-alive
  • Create Elevation profile from polyline coordinate array
  • jQuery trigger only occurs first time
  • IRC related help
  • Why MongoDB is Consistent not available and Cassandra is Available not consistent?
  • Bootstrap tooltip stops working after any other event runs
  • Migration of Google Project to Firebase Console
  • Is it possible to run a playbook in “pull mode”?
  • Java: List the dates between a start and end date [duplicate]
  • Changing date format in Pentaho using javascripting
  • Confused about how to update my datasources on my UITableView after app has been released
  • Passing variable into xp_cmdshell
  • dc.js / crossfilter dimensions (year / week)
  • Why querying a date BC is changed to AD in Java?
  • Row Count Is Returning the incorrect number using RaptureXML
  • Illegal mix of collations for operation for date/time comparison
  • Eraser for UIBezierPath
  • Release, debug version and Authorization Google?
  • Cannot Parse HTML Data Using Android / JSOUP
  • using conditional logic : check if record exists; if it does, update it, if not, create it
  • Suggestions to manage Login/Logout transitions
  • Hits per day in Google Big Query
  • JTable with a ScrollPane misbehaving
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`
  • unknown Exception android
  • EntityFramework adding new object to nested object collection
  • Checking variable from a different class in C#
  • failed to connect to specific WiFi in android programmatically
  • How can I use threading to 'tick' a timer to be accessed by other threads?