我正在开发 javafx 元素,我有一个 FXML 界面,我在其中放置了一个选项卡 Pane ,当我选择一个选项卡时,所选按钮的边框为蓝色,但我想要的样式是让白色颜色将不添加边框。
我的形象here有一个蓝色的轮廓。
得到这个image
我的用于设置选项卡 Pane 样式的 Css 代码:
.tab
{
-fx-background-color: #fbfbfb;
-fx-border-width: 0 0 1 0;
-fx-border-color: #c2c2c2 #c2c2c2 #c2c2c2 #c2c2c2
}
.tab:selected
{
-fx-background-radius: 0;
-fx-background-insets: 0;
-fx-background-color: #fbfbfb;
-fx-border-width: 0 0 3 0;
-fx-border-color: #c2c2c2 #c2c2c2 #ff9500 #c2c2c2
}
.tab-pane *.tab-header-background
{
-fx-background-color: #fbfbfb, #fbfbfb, #fbfbfb;
-fx-border-width: 1 0 1 0;
-fx-border-color: #c2c2c2 #c2c2c2 #c2c2c2 #c2c2c2
}
最佳答案
To find the default stylesheet of tabPane, I looked for the file jfxrt.jar in my computer, and I open it in an archiver like WinRAR to get caspian.css at com/sun/javafx/scene/control/skin/caspian.css. With this knowledge, I can easily see what could be there that causes the issue. caspian.css is also available online, here is the a link to the JavaFX 2.2 version.
我需要的是下面的代码:
.tab-pane:focused > .tab-header-area > .headers-region > .tab:selected .focus-indicator {
-fx-border-style: segments(0.166667em, 0.166667em);
-fx-border-width: 1;
-fx-border-color: -fx-focus-color;
}
关于css - 如何去除所选选项卡 Pane 中的蓝色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35260168/