JavaFx自定义按钮的外观

时间:2016-12-16 14:23:45

标签: java image button javafx

我将图片上传到了我的按钮,但它看起来像这样: enter image description here

按钮形状不像图像,边缘仍然可以看到按钮颜色。有没有办法改变这个?

2 个答案:

答案 0 :(得分:1)

使用:

button.setPadding(Insets.EMPTY);

答案 1 :(得分:0)

试试这个:

button.setStyle("-fx-background-radius: 0; -fx-padding: 0; -fx-background-color: transparent;");

你也可以在css中应用这种风格