[英]How to change the highlighting color in JavaFX?
How to change the highlighting color in JavaFX? 如何在JavaFX中更改突出显示颜色? Usually it is blue with gradients, but I would like to have a green highlighting.
通常它是带有渐变的蓝色,但是我想用绿色突出显示。 I have tried the following:
我尝试了以下方法:
.root{
-fx-shadow-highlight-color: #CCFF99;
}
Thanks for help! 感谢帮助!
Look at caspian.css (JavaFX 2) or modena.css (JavaFX 8) 查看caspian.css (JavaFX 2)或modena.css (JavaFX 8)
.root {
/* A bright blue for highlighting/accenting objects. For example: selected
* text; selected items in menus, lists, trees, and tables; progress bars;
* default buttons.
*/
-fx-accent: #0093ff;
/* A bright blue for the focus indicator of objects. Typically used as the
* first color in -fx-background-color for the "focused" pseudo-class. Also
* typically used with insets of -1.4 to provide a glowing effect.
*
* TODO: should this be derived from -fx-accent?
*/
-fx-focus-color: #0093ff;
}
Change these colors according to their usages. 根据用途更改这些颜色。
I think Uluk Biy has answered it great way. 我认为Uluk Biy回答了很好的方法。
But the reality is styling using CSS does not override the -fx-focus-color: #0093ff, rather it will overlap. 但是现实是使用CSS样式不会覆盖-fx-focus-color:#0093ff,而是会重叠。 If you use -fx-focus-color: red , it will get mixed with default blue color and show a shade of grey like color.
如果使用-fx-focus-color:red,它将与默认的蓝色混合,并显示类似颜色的灰色阴影。 The css attribute -fx-accent has no issues.
css属性-fx-accent没有问题。
Also you can use -fx-highlight-fill
on text-area
class selector. 您也可以在
text-area
类选择器上使用-fx-highlight-fill
。
.text-area {
-fx-highlight-fill: green;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.