简体   繁体   English

组合框CSS代码

[英]Combo box css code

I'm doing a university project with javafx but my css knowledge is very poor and I need some stuff. 我正在用Javafx进行大学项目,但是我的CSS知识很差,我需要一些东西。 I have some code that make grey combo-box's border and when you focus it the border change to blue, but when you click it the border change to white and I want that the border keep blue. 我有一些代码可以使灰色组合框的边框变成灰色,当您将其聚焦时,边框变为蓝色,但是当您单击它时,边框变为白色,我希望边框保持蓝色。 What I should add to my code? 我应该在代码中添加什么?

.combo-box-base {
    -fx-background-color: transparent, lightgrey, transparent, white;
    -fx-background-radius: 0, 0, 0, 0;
    -fx-padding: 0.166667em; /* 2 */
}

.combo-box-base:hover  {
    -fx-background-color: transparent,  #6699FF, transparent, white;

}

.combo-box-base:disabled {
    -fx-opacity: .4;
}

.combo-box-base .arrow-button {
    -fx-background-color: transparent, lightgrey, transparent, white;
}

.combo-box-base .arrow {
    -fx-padding: 0.333333em 0.333333em 0.333333em 0.333333em; /* 4 4 4 4 */
    -fx-shape: "M8.124,13.625l4.125-3.375v2.889l-4.125,3.86L4,13.139V10.25L8.124,13.625z";
}

.combo-box-popup .list-view {
    -fx-background-color: lightblue, -fx-control-inner-background;
    -fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0) , 8, 0.0 , 0 , 0 );
}

.combo-box-popup .list-view .list-cell:hover{
    -fx-background: -fx-accent;
    -fx-background-color: lightblue;
    -fx-text-fill: black;
}

.combo-box-popup .list-view .list-cell:filled:selected{
    -fx-background-color: #55c4fe;
}

.combo-box-popup .list-view .list-cell:filled:selected:hover {
    -fx-background-color: #6dcdff;
}

.combo-box-popup .list-view .list-cell:filled:pressed, .combo-box-popup .list-view .list-cell:filled:selected:pressed
{
    -fx-background-color: #d3d3d3;
    -fx-text-fill: #1d1d1d;
}

ComboBox on hover 将ComboBox悬停

在此处输入图片说明

ComboBox on selection 选择组合框

在此处输入图片说明

Just change this 只是改变这个

.combo-box-base:hover  {
    -fx-background-color: transparent, #6699FF, transparent, transparent, white;
}

Output: 输出:

在此处输入图片说明

you should add "white" instead of the color, simply change this: 您应该添加“白色”而不是颜色,只需更改即可:

.combo-box-base .arrow-button {
-fx-background-color: transparent, white, transparent, white;}




.combo-box-base {
-fx-background-color: transparent, white, transparent, white;
-fx-background-radius: 0, 0, 0, 0;
-fx-padding: 0.166667em; /* 2 */}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM