Java – DatePicker setEditable to false still allows for clicking of Calendar

calendardatepickerjavajavafx

I am currently trying to setEditable for a DatePicker to false so the value cannot be changed. Using the following only disables the text field, but still allows the changing of the date by clicking on the calendar button (the setEditable is for permissions, so I can enable/disable depending on the login):

exampleDatePicker.setEditable(user.getGroup().equals(admin));

Is there a way to disable the Calendar button on the DatePicker? I don't want to use setDisable, as I still want the field to be readable, and I can't change the CSS for disabled because I have other DatePickers that get disabled that I want greyed out.

Best Solution

For future searches, here's what I did:

dtpDate.setDisable(true);
dtpDate.setStyle("-fx-opacity: 1");
dtpDate.getEditor().setStyle("-fx-opacity: 1");
Related Question