Class DatePicker

  • All Implemented Interfaces:
    EventTarget

    public class DatePicker
    extends Dialog<LocalDate>
    DatePicker is a dialog that displays a custom control that allows the selection of a LocalDate based on the selection of a given day and month in the initial monthly view, and a given year in a yearly view.

    Based on Material Design guidelines, views can be switched by clicking in the labels that define the year, the day and month. Inside each view, months can be navigated by swipe gestures from left to right or right to left, as well as by dragging them to the left or to the right. Years can be navigated by scrolling vertically

    Screenshot of DatePicker

    The final selected local date will be available in the Dialog result property. Dialog.showAndWait() method will return an Optional instance with this result.

    Here is a typical implementation:

     
     DatePicker datePicker = new DatePicker();
     datePicker.showAndWait().ifPresent(System.out::println);
     

    Selected local date can be also accessed through the dateProperty() .

    Since:
    2.0.0
    See Also:
    TimePicker, Dialog