1

I have a graphical component JCalendar for choosing the date. A problem (or bug) persists when my local date is June 30; for example, I go through the months with the arrow when I go through the month of February, the date is inserted automatically (February 28) because the event "propertyChange" is starts unless I select.

What do you think?

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
naj_ib
  • 151
  • 1
  • 1
  • 10
  • 3
    Unfortunately your problem is not described clear enough. Could you please remove the UI issue from your description (as irrelevant) and explain which call to Calendar API do you perform and why do you think that it does not work correctly. – AlexR Jul 25 '11 at 16:17
  • nothing, maybe time to check how java.util.Calendar or PropertyChangeListener works, there are lots of JCalendars or JDatePicker picker around, check that how Focus works – mKorbel Jul 25 '11 at 16:21
  • What do you mean by 'the date is inserted automatically(February 28)'? Where is the date inserted? – Hunter McMillen Jul 25 '11 at 16:24
  • When i'm switching with the arrow months knowing that my default date is: June 30, I can not exceed the month of February => the Calendar closes and inserts the date: March 28 (knowing that I have not yet selected the Day). – naj_ib Jul 26 '11 at 08:48

1 Answers1

3

Assuming JCalendar and JSpinnerDateEditor, I see no discontinuities near June 30 or February 28 in JCalendarDemo. You might verify that you are observing the correct property change:

    JDateChooser spinner = new JDateChooser(new JSpinnerDateEditor());
    spinner.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
            System.out.println(e.getPropertyName()
                + ": " + e.getNewValue());
        }
    });
    this.add(spinner);

Addendum: I am unable to reproduce the effect you describe because it's a bug that's fixed here.

Addendum: The bug is also fixed in JCalendar, version 1.4.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • When i'm switching with the arrow months knowing that my default date is: June 30, I can not exceed the month of February => the Calendar closes and inserts the date: March 28 (knowing that I have not yet selected the Day) – naj_ib Jul 26 '11 at 10:12
  • Aha! It's bug; link to fix above. – trashgod Jul 26 '11 at 15:40
  • I tested that and if I sets 31/july/2011 and set Cursor to Month 07, then JSpinner works correctly (US/EU Locale) and jumping to the last day in present Month, there I can't see problem, yes I know one Bug with these Month/Days combinations, if you are use Month JComboBox, then jumping date from July (31/july/2011) to wrong Day in Februar (03/februar/2011), I'm only see there some issue with Focus, Fonts, BackGround, notifications for SpecialDays (hollydays ...), – mKorbel Jul 26 '11 at 17:14
  • @naj_ib try to compare with SwingX Calendar http://stackoverflow.com/questions/6818528/what-is-the-status-of-swinglabs-swingx-post-acquisition/6818776#6818776 – mKorbel Jul 26 '11 at 17:14