Javafx组合框造型 [英] Javafx combobox styling
本文介绍了Javafx组合框造型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在JavaFX低于其弹出行为可以被控制,如在点击而不是默认行为,其中它显示一个下拉组合框,我想在下拉组合框中上述要显示(insetad显示器的组合框组合框。
I need a combobox in javaFX whose popup behavior can be controlled, like upon clicking the combobox, instead of default behavior where it shows a drop down, i want the drop down to be shown above the combobox (insetad of display below the combobox) .
有可能吗?
我们可以用css做这个吗?
Is it possible ? Can we do this with css ?
感谢您的帮助。
推荐答案
我希望这对你有用。根据需要进行一些更改
I hope this will work for you. Make some changes according your need
.combo-box .list-cell
{
-fx-background: white;
-fx-background-color: transparent;
-fx-text-fill: -fx-text-base-color;
-fx-padding: 3 0 2 7;
-fx-cell-size: 1.66667em;
}
.combo-box-popup .list-view
{
-fx-background-color: white, white;
-fx-background-insets: 0, 1;
-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 8, 0.0 , 0 , 0 );
}
.combo-box-popup .list-view .list-cell
{
-fx-padding: 4 0 4 5;
/* No alternate highlighting */
-fx-background-color: white;
}
.combo-box-popup .list-view .list-cell:filled:selected, .combo-box-popup .list-view .list-cell:filled:selected:hover
{
-fx-background: -fx-accent;
-fx-background-color: -fx-selection-bar;
-fx-text-fill: -fx-selection-bar-text;
}
.combo-box-popup .list-view .list-cell:filled:hover
{
-fx-background-color: white;
-fx-text-fill: -fx-text-inner-color;
}
.combo-box-base
{
-fx-skin: "com.sun.javafx.scene.control.skin.ComboBoxBaseSkin";
-fx-background-color: white, white, white, white;
-fx-background-radius: 5, 5, 4, 3;
-fx-background-insets: 0 0 -1 0, 0, 1, 2;
-fx-padding: 0;
}
.combo-box-base:hover
{
-fx-color: -fx-hover-base;
}
.combo-box-base:showing
{
-fx-color: -fx-pressed-base;
}
.combo-box-base:focused {
-fx-background-color: -fx-focus-color, -fx-outer-border, -fx-inner-border, -fx-body-color;
-fx-background-radius: 6.4, 4, 5, 3;
-fx-background-insets: -1.4, 0, 1, 2;
}
.combo-box-base:disabled {
-fx-opacity: .4;
}
这篇关于Javafx组合框造型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文