首页 > 解决方案 > TabPane - 为什么我不能更改空选项卡区域的颜色?

问题描述

我正在尝试更改我正在处理的这个 JavaFX 项目中的灰色区域。我可以设法更改所有内容,但不能更改 TabPane 一侧的灰色区域。

我不确定是否必须按某种顺序设置 CSS 文件,或者我只是在这里遗漏了其他东西。

这是我的代码:

#tabPane {
    -fx-background-color: #94C5E3;
    -fx-tab-min-height: 64;
    -fx-tab-max-height: 64;
    -fx-tab-min-width: 64;
    -fx-tab-min-width: 64;
    -fx-padding: 0 -1- -1 0
}
.tab .tab-label {
    -fx-background-color: transparent;
    -fx-alignment: CENTER;
    -fx-text-fill: #627796;
}

.tab{
    -fx-background-color: #b5e4f6;
    -fx-pref-width: 100;
    -fx-background-insets: 0.0;
    -fx-background-radius: 0.0;
    -fx-padding: 0 30 0 30;
}

.tab:selected
{
    -fx-background-color: #94C5E3;
    -fx-background-radius: 0;
    -fx-background-insets: 0;
    -fx-border-width: 1 0 1 0;
    -fx-border-height: 1 0 1 0;
    -fx-border-color: transparent;

}

.tab:focused
{
    -fx-background-color: #94C5E3;
    -fx-focus-color: transparent;

}

.tab-tabPane *.tab-header-area .tab-header-background {
    -fx-opacity: 0;
    -fx-background-color: #b5e4f6;
}

.tab-pane:left *.tab-header-area
{
    -fx-background-color: #94C5E3;
    -fx-background-insets: 0, 0 0 10;
    -fx-padding: 0.0em 0.0em 0.0em 0.0em;

}

.tab:selected .focus-indicator
{
    -fx-focus-color: transparent;
    -fx-border-color: transparent;

}

这是它的样子: 在此处输入图像描述

标签: javacssjavafx

解决方案


推荐阅读