FXML标签文本加粗 [英] FXML Label text bold

查看:283
本文介绍了FXML标签文本加粗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我如何在Java FXML中使标签内的文本变为粗体吗?

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" />

谢谢.

推荐答案

试一下

legalLabel.setStyle("-fx-font-weight: bold;");

或尝试使您的fxml看起来像这样

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>


请尝试以下操作:legalLabel.setFont(Font.font("Verdana", FontWeight.BOLD, 12));

这篇关于FXML标签文本加粗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆