2016-05-09 77 views

回答

2

您可以將ImageView添加到StackPane,並使用StackPane作爲ToggleButton的圖形節點。然後你可以應用邊框到StackPane

ImageView graphic = new ImageView(imageUrl); 
    StackPane pane = new StackPane(graphic); 
    pane.setStyle("-fx-border-color: red; -fx-border-width:4; "); 

    ToggleButton toggleButton = new ToggleButton("", pane); 
+0

完美,謝謝! – SamC