我想在我的 JavaFx 2.0 应用程序中创建像歌剧网络浏览器这样的选项卡。我尝试使用许多 CSS 设置自定义选项卡,但没有成功。有人知道该怎么做吗?
问问题
1794 次
1 回答
2
您可以将一个类添加到单个选项卡以对其进行样式设置,如下所示:
.blue .tab-label {
-fx-text-fill: blue;
}
.red .tab-label {
-fx-text-fill: red;
}
.green .tab-label {
-fx-text-fill: lime;
}
要设置所有选项卡的样式,您可以使用这样的 CSS:
.tab-chat.tab:hover {
-fx-background-color: linear-gradient(to top, -fx-purple, -fx-control-inner-background);
}
.tab-chat:selected {
-fx-background-color: linear-gradient(to bottom, derive(-fx-base, 95%), -fx-control-inner-background );
-fx-background-insets: 0, 9 9 0 9;
-fx-background-radius: 12 12 0 0, 12 12 0 0;
-fx-font-weight: bold;
}
/* ----------------------------- */
/* Tabs background graphic */
/* ----------------------------- */
.tab-header-background {
-fx-background-image: url("images/back-rustyfill.jpg");
}
于 2012-05-25T09:07:27.447 回答