What are good Java date-chooser Swing GUI widgets?
Asked Answered
D

6

27

What are good Java Swing date-chooser components? So far I've only really found these 2:

  • JCalendar - this one is pretty good as it uses the underlying look and feel.
  • JXMonthView in the SwingX project - not so good as it uses its own look and feel

Both of these look a bit clunky when compared with some I've seen on web-pages. For example, it might be nice to see multiple months at the same time. Does anyone know of any other good widgets out there?

Delacroix answered 27/8, 2009 at 7:10 Comment(0)
A
16

Recently I found and use the Microba DatePicker (http://microba.sourceforge.net/) for a personal project involving Swing GUIs, and I actually I really liked the way this control is implemented. Besides, the license is BSD, so you will be able to customize the control and use it for commercial purposes if you need to do so.

Acridine answered 27/8, 2009 at 7:17 Comment(4)
If one is concerned about performance, one should know that this is one of the slowest date pickers to initialize. I have tried heaps of BSD licensed date pickersQuartziferous
but we can not make limit means restriction into the selecting date into this particular ControlWexford
I've tried 5 different swing DatePicker components, and this is the first to work correctly with the Synthetica look and feel. +1Grizzly
The Microba home page states that "This project is on hiatus". The same page recommends checking out LGoodDatePicker instead.Preexist
P
8

I've tried most of the date pickers out there.
I would suggest LGoodDatePicker.

https://github.com/LGoodDatePicker/LGoodDatePicker

Fair disclosure: I am the primary developer.

Here is a general feature list (as adapted from Github):

  • Automatic internationalization.
  • Uses the (new) standard Java 8 time package. Also called "java.time" or "JSR-310".
  • Automatic validation of dates.
  • Fonts and colors can be changed.
  • Optional highlight policies and veto policies.
  • Relatively compact source code (3 core classes).
  • Creating a DatePicker requires only one line of code.
  • Demo program and code samples included.
  • Good Javadocs.
  • Open source license.

Screenshots below:

LGoodDatePicker Screenshots

Preexist answered 19/2, 2016 at 11:40 Comment(0)
S
2

I'm often late but the best i've seen is : JDatePicker

(What has surprised me : week start with Sunday - like many Calendar and by the way Sunday is day 0 in Java - but you can edit the source and recompile to get it start with Monday instead ;-) )

Spirelet answered 24/2, 2012 at 23:13 Comment(3)
Well, originally Sunday was always the first day of the week.Diannediannne
SkyDan, not everywhere. In Russia first day of week was and still is monday. The ppint is JDatePicker is not well localized.Plank
Hello Isma Can we Resize the PoPUP Calender of the Date picker? plz help me.Wexford
C
1

There is also NachoCalendar.

Collin answered 17/10, 2009 at 15:6 Comment(0)
I
1

I came across this question myself recently. Found most of the answers obsolete or unsatisfactory so I created my own:

Sierra Date Picker

It is fully localized and available as part of the Sierra project on GitHub:

https://github.com/HTTP-RPC/Sierra

A time picker is also available:

Sierra Time Picker

Islam answered 14/2, 2023 at 23:34 Comment(0)
Z
0

jDateChooser which comes with jCalendar is the best component for date: Following is the way to get date from date picker:

//dat is name given to datepicker component
int day=dat.getJCalendar().getDayChooser().getDay();
int month=dat.getJCalendar().getMonthChooser().getMonth();
int year=dat.getJCalendar().getYearChooser().getYear();
String dateNow=year+"/"+month+"/"+day;
System.out.println(dateNow);

//***************************************************
//For setting date of date picker:
dat.setDateFormatString("dd-MM-yyyy");
Calendar currentDate = Calendar.getInstance();
dat.setDate(currentDate.getTime());
Zach answered 1/10, 2012 at 10:53 Comment(3)
which exactly do you mean? There are several very different variants out there :-) BTW: please format your code (there's a help button available which comes up with a how-to)Handwriting
jDateChooser which comes with jCalendarZach
I thought it to be easiest way for entering date in all other date pickersZach

© 2022 - 2024 — McMap. All rights reserved.