问题
Can someone please tell me how to make the text inside a label bold in Java FXML?
<Label fx:id="LegalLabel" text= "Legal Information" GridPane.halignment="RIGHT" GridPane.rowIndex="16" />
Thank you.
回答1:
Give this a shot
legalLabel.setStyle("-fx-font-weight: bold;");
or try making your fxml look like this
<Label fx:id="LegalLabel" text= "Legal Information" GridPane.halignment="RIGHT" GridPane.rowIndex="16">
<font>
<Font name="System Bold" size="13.0" />
</font>
</Label>
Edit: try this: legalLabel.setFont(Font.font("Verdana", FontWeight.BOLD, 12));
来源:https://stackoverflow.com/questions/49813907/fxml-label-text-bold