JavaFX 8 DatePicker style


How to change the style of the calendar in the DatePicker in JavaFX 8? I looked in all the default styles in modena file and i don't find the classes of the DatePicker. Anyone knows how to do it? For example, change the header color to blue.

The default style is the following:

enter image description here

10/27/2014 10:26:27 PM

Accepted Answer

You can find the css for the DatePickercontrol under .date-picker and .date-picker-popup style classes on the modena.css file.

If you want to change the header (I guess you mean the upper pane with Month and Year), this is what you need:

.date-picker-popup > .month-year-pane {
    -fx-padding: 0.588883em 0.5em 0.666667em 0.5em; /* 7 6 8 6 */
    -fx-background-color: derive(-fx-box-border,30%), 
        linear-gradient(to bottom, derive(-fx-base,-3%), 
                                   derive(-fx-base,5%) 50%, 
    -fx-background-insets: 0 0 0 0, 0 0 1 0;

You just need to add this style class to your css file, and change -fx-base to the color you want.

10/27/2014 11:49:21 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow