Button btn = new Button();
btn.setStyle(
"-fx-background-color: cadetblue;"+
"-fx-background-radius: 20;"+
"-fx-text-fill: antiquewhite;"+
"-fx-font-family: 'Microsoft YaHei UI';"+
"-fx-font-size: 50"
);
- 设置背景
-fx-background-radius: 20;//设置圆角
-fx-background-color: cadetblue;//背景颜色
- 设置字体
-fx-text-fill: antiquewhite;
-fx-font-family: ‘Microsoft YaHei UI’;
-fx-font-size: 50