Java Tips Weblog

  • Blog Stats

    • 2,530,128 hits
  • Categories

  • Archives

Local Date Combo

Posted by Darryl Burke on April 22, 2015

LocalDateCombo is a Swing date picker for selecting a java.time.LocalDate from a drop-down MonthView.  As with MonthView, the no-arg constructor creates a LocalDateCombo set to the current date, with no upper or lower limits.  Additionally, this uses a default format corresponding to java.time.format.FormatStyle.MEDIUM

Five more constructors allow you to set various combinations of initial / minimum (earliest) / maximum (latest) value, and the display format.  Here’s a LocalDateCombo with the MonthView dropped down:


This code created that LocalDateCombo, and the screenshot was captured on 4 April 2015.

new LocalDateCombo(,
      DateTimeFormatter.ofPattern("E d MMM, uuuu"));

Please note that you will need JDK8 to compile and use this class.  You will also need MonthView and related classes, published earlier.

Get The Code

See Also

Swing and Java 8
Month View
Year Month Spinner
Temporal Spinners

Related Reading

The Oracle Tutorials: Trail: Date Time
Java API: java.time.LocalDate
Java API: java.time.format.DateTimeFormatter
Java API: java.time.format.FormatStyle
Java API: javax.swing.JComboBox


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: