- java.lang.Object
-
- com.gluonhq.charm.glisten.control.Dialog<LocalDate>
-
- com.gluonhq.charm.glisten.control.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 aLocalDatebased 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
The final selected local date will be available in the
Dialogresult property.Dialog.showAndWait()method will return anOptionalinstance 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
-
-
Property Summary
Properties Type Property Description ObjectProperty<LocalDate>dateTheObjectPropertywith the selectedLocalDate
-
Constructor Summary
Constructors Constructor Description DatePicker()Creates a new dialog, where the initial selected local date is the current one from the system clock in the default time-zoneDatePicker(LocalDate date)Creates a new dialog using given local date
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectProperty<LocalDate>dateProperty()TheObjectPropertywith the selectedLocalDateLocalDategetDate()Returns the selectedLocalDatevoidsetDate(LocalDate value)Sets theLocalDate-
Methods inherited from class com.gluonhq.charm.glisten.control.Dialog
autoHideProperty, buildEventDispatchChain, contentProperty, contentTextProperty, getButtons, getContent, getContentText, getGraphic, getId, getOnCloseRequest, getOnHidden, getOnHiding, getOnShowing, getOnShown, getTitle, getTitleText, graphicProperty, hide, idProperty, isAutoHide, isFullscreen, isShowing, onCloseRequestProperty, onHiddenProperty, onHidingProperty, onShowingProperty, onShownProperty, setAutoHide, setContent, setContentText, setGraphic, setId, setOnCloseRequest, setOnHidden, setOnHiding, setOnShowing, setOnShown, setResult, setTitle, setTitleText, showAndWait, showingProperty, titleProperty, titleTextProperty
-
-
-
-
Property Detail
-
date
public final ObjectProperty<LocalDate> dateProperty
TheObjectPropertywith the selectedLocalDate- See Also:
getDate(),setDate(LocalDate)
-
-
Constructor Detail
-
DatePicker
public DatePicker()
Creates a new dialog, where the initial selected local date is the current one from the system clock in the default time-zone
-
DatePicker
public DatePicker(LocalDate date)
Creates a new dialog using given local date- Parameters:
date- the initial local date
-
-
Method Detail
-
dateProperty
public final ObjectProperty<LocalDate> dateProperty()
TheObjectPropertywith the selectedLocalDate- See Also:
getDate(),setDate(LocalDate)
-
getDate
public final LocalDate getDate()
Returns the selectedLocalDate- Returns:
- The selected
LocalDate
-
-