【发布时间】:2018-04-03 17:11:41
【问题描述】:
我正在尝试制作具有最小宽度和高度的选项卡,用于触摸屏上的手指大小,而不是其中文本的大小。
.tab-pane *.tab-header-area *.tab-header-background {
-fx-background-color:transparent;
-fx-tab-min-width:120px;
-fx-tab-max-width:120px;
-fx-tab-min-height:50px;
-fx-tab-max-height:50px;
}
.tab {
-fx-font-family: Arial;
-fx-font-size: 18;
-fx-background-color:royalblue ;
}
.tab:selected {
-fx-background-color:blue ;
}
颜色和字体正常,但大小无效。我尝试了多种尺寸,使用 px 和 em,但没有效果。
TabPane tabPane = new TabPane();
Tab tab1 = new Tab();
tab1.setText("Machine");
tab1.setClosable(false);
Tab tab2 = new Tab();
tab2.setText("Shifts");
tab2.setClosable(false);
tabPane.getTabs().addAll(tab1, tab2);
【问题讨论】:
-
你导入样式表了吗?
-
是的,对于场景。正如我所说,我得到的是字体和颜色,而不是大小。
标签: user-interface javafx