我已经提供了一个类,它创建了一个按钮布局,但只有文本内部.我想知道是否还有相应的图标添加到按钮:
public ShapeButtons(View view){
String[] buttonLabels = { "Circle", "Rectangle", "Square", "Squiggle", "Polyline" };
for (String label : buttonLabels) {
Button button = new Button(label);
button.setMinWidth(100);
this.add(button, 0, row);
row++;
button.setOnAction(this);
}
Run Code Online (Sandbox Code Playgroud)
对于按钮的构造函数,我知道有一种方法可以做Button(文本,节点图形),但我似乎无法弄清楚如何做到这一点?