OptionDatePicker
extends XDatePicker and has an embedded menu-button which can be
configured to act as regular button. Each control with such an option button implements the interface OptionControl
.
OptionDatePicker#getMenuItems()
can be used to add/remove menu items.
The screenshot was taken from OptionDatePickerDemo - the Demo can be downloaded from the link below.
OptionDatePicker picker = new OptionDatePicker();
CheckMenuItem mi = new CheckMenuItem("Item A");
mi.setSelected(true);
picker.getMenuItems().add(mi);
picker.getMenuItems().add(new SeparatorMenuItem());
picker.getMenuItems().add(new CheckMenuItem("Item B"));
picker.getMenuItems().add(new CheckMenuItem("Item C"));
picker.setPromptText("Select Date");
picker.setOnAction((evt) -> System.out.println("Action"));
//picker.setClearButtonPosition(HPos.LEFT);
picker.setPrefWidth(250);
centerPane.getChildren().add(picker);