Giter VIP home page Giter VIP logo

jdatepicker's Introduction

JDatePicker

Java Swing Date Picker

JDatePicker and JDatePanel is an set of advanced DatePicker controls for Java Swing applications. The MVC design enables us to display any date object such as Joda-Time DateMidnight. The date picker also works well with JGoodies Binding.

News and other information can be found at: http://jdatepicker.org

Screenshots

Collapsed

Dialog

Panel

Features

  • Edit
  • JDatePicker component which pops up
  • JDatePanel component which can resize
  • JodaTime, util.Calendar or util.Date integration
  • JGoodies Binding friendly
  • Change formatting of date
  • Deployed in Maven central repository
  • Optional year selector
  • Double click or single click actions
  • Localisation support
  • Touch screen friendly large version
  • MVC (model view controller) design
  • Familiar Look and feel - similar to MS date picker

User reviews

Nice component, it simple!! Just a read a little of code and easy!! Thanks(sic) Five stars

jthan24

gracias Five stars

adriandavis

Works, very small, no complaints. Five stars

kalebhartman

great program jdatepicker, thanks. Five stars

elliotmartinez

Recomendo Five stars

evanrodrigues

Great product jdatepicker Five stars

ianzimmerman

Great work ! Five stars

markthomas55

The best open source Swing calendar widget. Dashbov project has become a much better tool thanks to him. Congratulations. Five stars

evertonbg

The JDatePicker is really eary(sic) to use. Five stars

micheal822

For some strange reason, there just ain't really a lot of decent, Open Source date pickers available for the Java platform. JDatePicker is making up for this ;) Five stars

demaniak

About

This project started in April 2004 before many of the currently available components for date selection of the current day. It was originally developed to be used in a commercial application, therefore a BSD license was a good fit.

The widget has since become quite popular (5 stars on sourceforge & around 370 downloads per week from sf.net). However, there may be many more downloads from the maven central repo, it is hard to guage exactly how many. If your project is using it, let me know and will make a mention on jdatepicker.org.

Way back in the day, sourceforge.net was a popular source code hosting service, it has served its purpose well. I am thankful for the many years of the free service enjoyed there. But since then github.com emerged, with a easier workflow for open source projects. For these reasons the project has finally moved to github.com.

Forks and pull requests are absolutely welcomed. Also please submit issues on the github issue page, this is the preferred way of getting help.

Older binaries are still available on the maven central repo. Future binary versions will also be distributed there again.

So use it freely and enjoy! You can check for more information at jdatepicker.org.

jdatepicker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jdatepicker's Issues

Date Panel view "Today Label" doesn't update if system date changed

Test Case :
Pre-Condition:

  1. Launch Date Panel
  2. Check date that is focused in the current month view - It as focus on 4th of November 2014.
  3. Check "Today Label" Text - It has correct system date (eg: 4/11/2014)

Use Case:

  1. Change the system date to 10/11/2014.
    Expected Result :
  2. Check date that is focused in the current month view - It should have focus on 10th of November 2014.
  3. Check "Today Label" Text - It should have current system date that is 10/11/2014

Actual :
Pass: 1) Focus is on 10/11/2014 in month view.
Failed: 2) Today label still has old system date 4/11/2014.

Proposed fix available :
Commit id : ffe8a82
forced under : r-mattasa

@Override invalid with Source Level 1.5 on Interface implementation

With the added methods set- and getButtonIcon() eclipse shows a warning about the annotations. As the source level is 1.5 these annotations are not valid here.
As we both seem to use a newer JDK to compile the code, it compiles flawless using maven.
But using a real 1.5 JDK the code cannot compile.

Either change the source level to 1.6 or remove the annotations.

Issue introduced with 43c8725.

JDatePicker with Locale.German loses 01 March 2015

Hi!

I tested this issue with JDK6 (Win 7) and the current cloned git repo (02 March 2015). When locale German is set, then the calendar starts the week with monday (as desired). But if the month starts with a sunday, then the first of the month is not selectable e.g., February 01, 2015 or March 01, 2015, because the view starts with monday March 02, 2015 . Is this a bug or is this a configuration failure?

Thanks in advanced!
Lukas

Double clicking month label hides the popup

Steps to reproduce:
Use Testcase for Issue 31.

  • Open the Popup Panel with the button
  • Click on the month label to show the Menu
  • Don't move the mouse, just wait a sec and click a second time

The Menu stays open, but the underlying Panel hides, see attached screenshot.
screencap

Month selection with this menu works fine though, just the hiding panel is curious.

Create stackoverflow tags "jdatepicker"

Since you're dealing with questions on stackoverflow.com (which is very smart!) there should be a SO tag jdatepicker. In case someone with 1500 reputation stumbles over this question, you might want to create the tag on the question http://stackoverflow.com/questions/38829977/how-to-make-a-model-changes-visible-on-a-jdatepicker. It's not welcome to create tags explicitly with asking/editing a question.

Project maintainer should then subscribe to the tag in order to make sense.

"org.jdatepicker.i18n.Text" missing

private ComponentTextDefaults() { texts = toProperties(ResourceBundle.getBundle("org.jdatepicker.i18n.Text", Locale.getDefault())); }

this happens on file ComponentTextDefaults.java on master branch.
image

How do I construct a JDatePanel now?

Since the upgrade from 1.3.2 to 1.3.4, I'm confused on how I'm supposed to be constructing JDatePanelImpl objects. I used to construct a DateModel and then call the single-argument JDatePanelImpl(DateModel) constructor. But that constructor is gone as of 1.3.4. And there doesn't seem to be good guidance on how to construct the i18strings Properties.

Should clients be using the JDateComponentFactory object instead of calling JDatePanelImpl constructors? Are those factory methods guaranteed to always return the ...Impl classes so we can cast them down and use them as JComponents to get them in to our component tree?

Which parts of the JDatePicker library are the public interface for clients to call?

Potential resource leak in ComponentIconDefaults.java

I'm compiling JDatePicker master branch with Eclipse and I'm getting this warning:

"Potential resource leak: 'stream' may not be closed at this location"

The warning is in org/jdatepicker/ComponentIconDefaults.java at line 54.

This is easily solved closing the stream object before exit:

    ...
    BufferedImage image = ImageIO.read(stream);
    stream.close();    // <--- New line
    return new ImageIcon(image);
    ...

Please add this modification to master branch.

Getting date from calendar uses system time for hour/minute/seconds

I have two jdatepickers in this form I have. I have a user enter date1 and date2, and validation where date1 after date2.

I have noticed that even if I pick the same days in the picker, calling date1.after(date2) will return true. Printing out both values gives me something like this:

Sat Mar 12 14:06:55 MST 2016
Sat Mar 12 14:06:55 MST 2016
1 (date is after other)

The time I generated this at is 14:13:?? so its like it caches the time the picker started. I chose one of those dates at 14:12 but it still shows 06.

Events fired not intuitive and unnecessary

Tests:

  1. Deleting Textfield contents with backspace and leaving field by pressing tab character: OK

value: java.util.GregorianCalendar[time=1416265200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2014,MONTH=10,WEEK_OF_YEAR=47,WEEK_OF_MONTH=3,DAY_OF_MONTH=18,DAY_OF_YEAR=322,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=0] -> null
selected: true -> false

  1. Re-Focusing field and pressing Enter / Tabs: No changes fired -> OK

  2. Selecting a new value by directly entering one and leaving field by Tab: Partly OK, there seems to be too many events fired. Especially the first four events seem unnecessary.

value: null -> null
month: 10 -> 0
day: 18 -> 1
value: null -> null
value: null -> java.util.GregorianCalendar[time=1388530800000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2014,MONTH=0,WEEK_OF_YEAR=1,WEEK_OF_MONTH=1,DAY_OF_MONTH=1,DAY_OF_YEAR=1,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=1,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=0]
selected: false -> true

  1. Deleting the value by pressing the "X" Button in the Popup: OK, Although the first event is unnecessary.

value: null -> null
value: java.util.GregorianCalendar[time=1416265200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2014,MONTH=10,WEEK_OF_YEAR=47,WEEK_OF_MONTH=3,DAY_OF_MONTH=18,DAY_OF_YEAR=322,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=0] -> null
selected: true -> false
Action: java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=Date selected,when=0,modifiers=] on org.jdatepicker.impl.JDatePanelImpl[,0,0,202x182,invalid,layout=java.awt.GridLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.border.LineBorder@5e249aa8,flags=9,maximumSize=,minimumSize=,preferredSize=]

  1. Selecting the current date in the popup: OK, See 3 & 4

value: null -> null
value: null -> java.util.GregorianCalendar[time=1416265200000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2014,MONTH=10,WEEK_OF_YEAR=47,WEEK_OF_MONTH=3,DAY_OF_MONTH=18,DAY_OF_YEAR=322,DAY_OF_WEEK=3,DAY_OF_WEEK_IN_MONTH=3,AM_PM=0,HOUR=0,HOUR_OF_DAY=0,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=0]
selected: false -> true
Action: java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=Date selected,when=0,modifiers=] on org.jdatepicker.impl.JDatePanelImpl[,0,0,202x182,invalid,layout=java.awt.GridLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.border.LineBorder@5e249aa8,flags=9,maximumSize=,minimumSize=,preferredSize=]
As you can see, the events are not intuitive, I'm asking myself if this could be a problem if you rely on them in another program.

Implement JComponent

Change component not to inherit from JPanel but rather to be it's own JComponent.

First day of month is not selectable with Mo as first dow.

Hi!

I tested this issue with JDK6 (Win 7) and the current cloned git repo (02 March 2015). When locale German is set, then the calendar starts the week with monday (as desired). But if the month starts with a sunday, then the first of the month is not selectable e.g., February 01, 2015 or March 01, 2015, because the view starts with monday March 02, 2015 . Is this a bug or is this a configuration failure?

Thanks in advanced!
Lukas

JDatePicker - java.lang.NullPointerException

Can somebody help me, please?
Sometimes I get an annoying error while using JDatePicker.
What should I do?

Thank you very much!

    at org.jdatepicker.impl.JDatePanelImpl$InternalTableCellRenderer.getTableCellRendererComponent(JDatePanelImpl.java:598)
    at javax.swing.JTable$AccessibleJTable.getAccessibleAt(JTable.java:6990)
    at sun.lwawt.macosx.CAccessibility$23.call(CAccessibility.java:414)
    at sun.lwawt.macosx.CAccessibility$23.call(CAccessibility.java:393)
    at sun.lwawt.macosx.LWCToolkit$CallableWrapper.run(LWCToolkit.java:598)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:719)
    at java.awt.EventQueue$4.run(EventQueue.java:717)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
java.lang.NullPointerException
    at org.jdatepicker.impl.JDatePanelImpl$InternalTableCellRenderer.getTableCellRendererComponent(JDatePanelImpl.java:598)
    at javax.swing.JTable$AccessibleJTable.getAccessibleAt(JTable.java:6990)
    at sun.lwawt.macosx.CAccessibility$23.call(CAccessibility.java:414)
    at sun.lwawt.macosx.CAccessibility$23.call(CAccessibility.java:393)
    at sun.lwawt.macosx.LWCToolkit$CallableWrapper.run(LWCToolkit.java:598)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:744)
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:719)
    at java.awt.EventQueue$4.run(EventQueue.java:717)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at org.jdatepicker.impl.JDatePanelImpl$InternalTableCellRenderer.getTableCellRendererComponent(JDatePanelImpl.java:598)
    at javax.swing.JTable$AccessibleJTable.getAccessibleChild(JTable.java:7031)
    at javax.swing.JTable$AccessibleJTable.getAccessibleAt(JTable.java:7418)
    at javax.swing.JTable$AccessibleJTable.valueChanged(JTable.java:6933)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:184)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:164)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:211)
    at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:405)
    at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:415)
    at javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:459)
    at javax.swing.JTable.changeSelectionModel(JTable.java:2389)
    at javax.swing.JTable.changeSelection(JTable.java:2458)
    at javax.swing.plaf.basic.BasicTableUI$Handler.adjustSelection(BasicTableUI.java:1115)
    at javax.swing.plaf.basic.BasicTableUI$Handler.mousePressed(BasicTableUI.java:1038)
    at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mousePressed(BasicTableUI.java:798)
    at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:280)
    at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:279)
    at java.awt.Component.processMouseEvent(Component.java:6522)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6290)
    at java.awt.Container.processEvent(Container.java:2234)
    at java.awt.Component.dispatchEventImpl(Component.java:4881)
    at java.awt.Container.dispatchEventImpl(Container.java:2292)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4530)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
    at java.awt.Container.dispatchEventImpl(Container.java:2278)
    at java.awt.Window.dispatchEventImpl(Window.java:2739)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:719)
    at java.awt.EventQueue$4.run(EventQueue.java:717)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at org.jdatepicker.impl.JDatePanelImpl$InternalTableCellRenderer.getTableCellRendererComponent(JDatePanelImpl.java:598)
    at javax.swing.JTable$AccessibleJTable.getAccessibleChild(JTable.java:7031)
    at javax.swing.JTable$AccessibleJTable.getAccessibleAt(JTable.java:7418)
    at javax.swing.JTable$AccessibleJTable.valueChanged(JTable.java:6933)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:184)
    at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:154)
    at javax.swing.DefaultListSelectionModel.setValueIsAdjusting(DefaultListSelectionModel.java:685)
    at javax.swing.plaf.basic.BasicTableUI$Handler.setValueIsAdjusting(BasicTableUI.java:953)
    at javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleased(BasicTableUI.java:1166)
    at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mouseReleased(BasicTableUI.java:802)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
    at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
    at java.awt.Component.processMouseEvent(Component.java:6525)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
    at java.awt.Component.processEvent(Component.java:6290)
    at java.awt.Container.processEvent(Container.java:2234)
    at java.awt.Component.dispatchEventImpl(Component.java:4881)
    at java.awt.Container.dispatchEventImpl(Container.java:2292)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4898)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4533)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4462)
    at java.awt.Container.dispatchEventImpl(Container.java:2278)
    at java.awt.Window.dispatchEventImpl(Window.java:2739)
    at java.awt.Component.dispatchEvent(Component.java:4703)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:746)
    at java.awt.EventQueue.access$400(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.awt.EventQueue$3.run(EventQueue.java:691)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.awt.EventQueue$4.run(EventQueue.java:719)
    at java.awt.EventQueue$4.run(EventQueue.java:717)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:716)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)´´´

Use of shared popup factory

To get JDatePicker to work in my environment, I had to change it to use the shared PopupFactory instance instead of creating its own PopupFactory. Also, the mouse clicked event handler does not work with heavyweight popups, so I commented it out. It is not clear to me why this code is needed because similar code is present in the JDK.

Text disapearing while resizing JTextField

Hi,

First of all, thank you for that awesome package, very usefull, light, easy and needs just a few words to work.

I needed in my application to customize the JTextField, where the date is displayed. By customizing I mean changing color, font and size. All worked well except for the last one, here is a runnable example :

import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Properties;

import javax.swing.JFrame;

import org.jdatepicker.impl.JDatePanelImpl;
import org.jdatepicker.impl.JDatePickerImpl;
import org.jdatepicker.impl.UtilDateModel;

public class Start {
    public static void main(String[] args) {
        System.out.println("");
        JFrame f = new JFrame("Testing resizing");
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.pack();
        f.setLocationRelativeTo(null);
        f.setVisible(true);

        UtilDateModel model = new UtilDateModel();
        Properties p = new Properties();
        p.put("text.today", "Aujourd'hui");
        p.put("text.month", "Mois");
        p.put("text.year", "Année");
        java.util.Calendar calendar = new GregorianCalendar();
        model.setDate(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH));
        model.setSelected(true);
        JDatePanelImpl datePanel = new JDatePanelImpl(model,p);
        JDatePickerImpl datePicker = new JDatePickerImpl(datePanel, new DateLabelFormatter());
        Container p1 = f.getContentPane();
        p1.add(datePicker);
        p1.setLayout(new FlowLayout(FlowLayout.LEFT));
        Component tf = datePicker.getComponent(0);
        tf.setBackground(Color.PINK);
        tf.setFont(new Font("Dialog", Font.BOLD, 11));
        tf.setPreferredSize(new Dimension(100, 100));
    }
}

As you can see the text disappeared.

Hope that'll help.

EDIT, here is my DateLabelFormatter class :

public class DateLabelFormatter extends AbstractFormatter {

        private String datePattern = "dd/MM/yyyy";
        private SimpleDateFormat dateFormatter = new SimpleDateFormat(datePattern, Locale.ENGLISH);

        @Override
        public Object stringToValue(String text) throws ParseException {
            if(text.length()==10) {
                return dateFormatter.parseObject(text);
            }
            return null;
        }

        @Override
        public String valueToString(Object value) throws ParseException {
            if (value != null) {
                Calendar cal = (Calendar) value;
                return dateFormatter.format(cal.getTime());
            }

            return "";
        }

    }

DatePicker can't be enabled/disabled

JDatePickerImpl is always enabled, ignoring the value of setEnabled. A disabled component should not respond to user input.

A straightforward solution would be to add the following setEnabled method to JDatePickerImpl:

public void setEnabled(boolean enabled) {
    button.setEnabled(enabled);
    formattedTextField.setEnabled(enabled);
}

Howto Documentation

Requests have been made for user documentation to be provided. A one pager PDF usage guide will suffice.

NullPointerException at JDatePanelImpl$InternalTableCellRenderer.getTableCellRendererComponent(JDatePanelImpl.java:607)

MacOSX version: 10.10.5
Java version: 1.8.0_45
JDatePicker version: 1.3.2 (from maven repo, but looking at the latest code in git hub this problem still exists)

JDatePanel crashes with a NPE as it doesn't handle the Mac Accessibility feature.

You can recreate this by using the Xcode Accessibility Inspector Tool to inspect the accessibility status of JDatePanel. If you hover the mouse over any date in the calendar, this crash will occur.

The full stack trace is in the following comment.

It seems that it is due to the method:

InternalTableCellRenderer.getTableCellRendererComponent() 

not handling the case where the second argument may be null if this method is called from an AccessibleJtable.

If you take a look at javax.swing.JTable$AccessibleJTable.getAccessibleChild(JTable.java:7044) you can see the call:

Component component = renderer.getTableCellRendererComponent(
                                  JTable.this, null, false, false,
                                  row, column);

Note that the second argument is null, and if you go to the documentation for getTableCellRendererComponent it states that null is a valid value so you should be handling this case in JDatePanelImpl in the event that the accessibility feature has been turned on on the Mac.

getMonth() form DateModel returns incorrect month number

I created a component like this:

JDatePicker startDate = (new JDateComponentFactory()).createJDatePicker();
mainPanel.add((Component) startDate);

When getting the Month form the component using startDate.getModel().getMonth() it seems to return a zero-indexed month. For example, it returns 0 for January, 1 for February, etc.

JSR 310 integration (aka Java 8 time, or java.time)

JSR 310 is the new java date/time API which ships standard with Java 8 under the package "java.time". It is a modified (upgraded) version of Joda time. JSR-310 was primarily developed by the same programmer who made Joda time, Stephen Colebourne. The front page of the Joda time website recommends that "From Java SE 8 onwards, users are asked to migrate to java.time (JSR-310) [instead of using Joda Time]." ( http://www.joda.org/joda-time/ )

To keep JDatePicker up to date with the latest version of Java, I imagine it should be integrated with JSR 310. Of special interest would be the ability to read and write java.time.LocalDate instances to a JDatePicker.

Information links:
https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html
https://dzone.com/articles/deeper-look-java-8-date-and
http://blog.joda.org/2009/11/why-jsr-310-isn-joda-time_4941.html

Explain how to support the project

Add a hint to CONTRIBUTING or README about wanted support for the project (code, printed paper with defined value, coffee, beer, pizza, none, publicity).

Change events not firing when erasing date in text field.

No change events are firing if you manually erase the date in a JDatePicker.

Steps to reproduce:
Create a JDatePicker.
Set the text to be editable.
Subscribe to change events for the JDatePicker or the date model.
In the formatted text field, highlight and erase the date.

The JDatePicker does not fire any change event, and the date model does not fire any change event.

Thank you,
Blake

Clicking on button

With focus in an empty text field click on button for widget breaks sometimes.

Month selector drop-down not selecting the correct month in certain cases.

Steps to reproduce:
Choose a the last day of a month with a long number of days (for example August 31)
Use the month selector drop-down to select a month with a shorter number of days (for example February)
The date that is selected is not inside of February.

Note: I have already fixed this bug, and created a pull request that includes the fix.

Warm regards,
Blake

Limit day selection

Constrain day's which can be selected:

  • Date to be selected must be in range
  • Date to be selected must be a weekday
  • Implement interface to test any date against to allow custom selection constraints

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.