【发布时间】:2018-11-08 22:48:44
【问题描述】:
所以我试图在 JavaFX 中显示所有文本,它应该显示字体中的所有文本: 这是我的 javafx 代码
<HBox>
<GridPane xmlns:fx= "http://javafx.com/fxml" hgap = "10" vgap = "0">
<Button text = "Explore Catalogue" alignment = "center" styleClass = "largeButton" GridPane.columnIndex="0" GridPane.rowIndex="2"/>
<Button text = "Customer Record" styleClass = "largeButton" GridPane.columnIndex="1" GridPane.rowIndex="2"/>
<Button text = "Top-up Account" styleClass = "largeButton" GridPane.columnIndex="2" GridPane.rowIndex="2"/>
<Button text = "Favourite Movies" styleClass = "largeButton" GridPane.columnIndex="3" GridPane.rowIndex="2"/>
</GridPane>
这段代码只能给出这个输出: 如何在不更改应如下所示的字体属性的情况下显示按钮中的所有文本: 我的按钮css代码是:
.largeButton {
-fx-font-family: "Verdana";
-fx-pref-width: 200px;
-fx-pref-height: 200px;
-fx-font-size: 28px;
-fx-background-color: white;
-fx-text-fill: #4d4b44;
-fx-border-color: #dedede;
}
【问题讨论】:
-
你试过
-fx-wrap-text: true;吗?