JavaFX 8 DatePicker样式 [英] JavaFX 8 DatePicker style
问题描述
如何在JavaFX 8中的DatePicker中更改日历的样式?我查看了modena文件中的所有默认样式,我没有找到DatePicker的类。有人知道怎么做吗例如,将标题颜色更改为蓝色。
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.
默认样式如下:
推荐答案
p>您可以在 .date-picker
和下找到
modena.css文件中的样式类。 DatePicker
控件的css。日期选择器弹出
You can find the css for the DatePicker
control 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%,
derive(-fx-base,-3%));
-fx-background-insets: 0 0 0 0, 0 0 1 0;
}
您只需要将这个样式类添加到您的css文件中,然后更改 -fx-base
到你想要的颜色。
You just need to add this style class to your css file, and change -fx-base
to the color you want.
这篇关于JavaFX 8 DatePicker样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!