oxbow_lakes
oxbow_lakes

Reputation: 134270

What are good Java date-chooser Swing GUI widgets?

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

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?

Upvotes: 27

Views: 89961

Answers (6)

Greg Brown
Greg Brown

Reputation: 3254

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

Upvotes: 1

BlakeTNC
BlakeTNC

Reputation: 971

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

Upvotes: 8

Ajinkya Jagtap
Ajinkya Jagtap

Reputation: 19

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());

Upvotes: 0

fencingCode
fencingCode

Reputation: 1427

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 ;-) )

Upvotes: 2

tuler
tuler

Reputation: 3399

There is also NachoCalendar.

Upvotes: 1

Abel Morelos
Abel Morelos

Reputation: 1248

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.

Upvotes: 16

Related Questions