0

I've added DatePicker with the help of Scene Builder into my fxml page. How can I customize its date and also set current date at initial?

VBox vBox = (VBox) loader.load();
rootLayout.setRight(vBox);
DatePicker checkInDatePicker = new DatePicker(LocalDate.of(1998, 10, 8));
checkInDatePicker.setValue(LocalDate.now());
Pang
  • 9,564
  • 146
  • 81
  • 122
Sreekanth
  • 31
  • 1
  • 11

1 Answers1

0

You can set the date inside the initialize() of the controller.

public class Controller implements Initializable {

    @FXML 
    DatePicker checkInDatePicker;

    ...

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        checkInDatePicker.setValue(LocalDate.now());
    }
}
ItachiUchiha
  • 36,135
  • 10
  • 122
  • 176