简体   繁体   English

JavafX使用CSS设置Tabpane颜色

[英]JavafX set tabpane colour with css

Two problems: 两个问题:

  1. I'm trying to set my table backgrounds, which I've achieved. 我正在尝试设置已经实现的表格背景。 However, if I specify a default table width, the unused part of the table defaults to the javafx table appearance. 但是,如果指定默认表宽度,则表的未使用部分默认为javafx表外观。 How can I set this with CSS? 如何使用CSS进行设置?

https://drive.google.com/file/d/0B_YEgxccklmHSC1BcTdULWJUUFk/view?usp=sharing https://drive.google.com/file/d/0B_YEgxccklmHSC1BcTdULWJUUFk/view?usp=sharing

https://drive.google.com/file/d/0B_YEgxccklmHZ0d2VDFZYUVDc1E/view?usp=sharing https://drive.google.com/file/d/0B_YEgxccklmHZ0d2VDFZYUVDc1E/view?usp=sharing

  1. My other problem, I can't set the background behind my tabpanes to white. 我的另一个问题是,我无法将Tabpanes后面的背景设置为白色。 I cannot find the syntax for this. 我找不到此语法。 See below. 见下文。

https://drive.google.com/file/d/0B_YEgxccklmHZ1RFNHNlY1pYTGc/view?usp=sharing https://drive.google.com/file/d/0B_YEgxccklmHZ1RFNHNlY1pYTGc/view?usp=sharing

Any help appreciated. 任何帮助表示赞赏。

Thx! 谢谢!

Regarding 2.) Try setting the background color of tab-header-background . 关于2.)尝试设置tab-header-background的背景颜色。 Here an example: 这里是一个例子:

.tab-pane>*.tab-header-area>*.tab-header-background {
   -fx-background-color: -fx-outer-border, -fx-text-box-border, white;
}

在此处输入图片说明

I copied this snippet from the default Modena theme and modified it. 我从默认的Modena主题复制了此代码片段,并对其进行了修改。 The '>' selector selects direct children and the '*' is called the universal selector and it selects a single element of any type. “>”选择器选择直接子代,“ *”称为通用选择器 ,它选择任何类型的单个元素。 However, it can be ommitted here, since it is used in combination with a simple selector. 但是,由于它与简单的选择器结合使用,因此可以在此处省略。

Sorry I do not know how to solve your first problem yet. 抱歉,我不知道如何解决您的第一个问题。 Maybe I'll find something. 也许我会找到一些东西。

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

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