D3KA D3KA - 5 months ago 19
CSS Question

Combo box css code

I'm doing a university project with javafx but my css knowledge is very poor and I need some stuff. 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

enter image description here

ComboBox on selection

enter image description here

Answer

Just change this

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

Output:

enter image description here