为什么此边框不再起作用?

时间:2019-08-17 19:59:25

标签: java javafx

你好,我不明白为什么这个边界不会炫耀。 (我尝试了两个版本,一个是我更改为评论的版本,另一个是在上面的版本)

public class MyPane extends BorderPane{

private int score=0;

public MyPane() {
    this.score=0;
    init();
    // TODO Auto-generated constructor stub
}
    public void init() {
    BorderPane bp1= new BorderPane();

    Image img=new Image("Ball.png");
    ImageView imv= new ImageView(img);
    imv.setFitHeight(100);
    imv.setFitWidth(100);
    Label label= new Label(Integer.toString(score));
    label.setPrefSize(100, 100);
    label.setFont(new Font(50));
    label.setPadding(new Insets(18));



    HBox hbox= new HBox();
    hbox.setBorder(new Border(new BorderStroke(Color.DARKGREEN, BorderStrokeStyle.SOLID, null , null)));
    //hbox.setStyle("-fx-padding: 10;" + "-fx-border-style: solid inside;"
    //        + "-fx-border-width: 2;" + "-fx-border-insets: 5;"
     //       + "-fx-border-radius: 5;" + "-fx-border-color: blue;");
    hbox.getChildren().add(imv);
    hbox.getChildren().add(label);
    hbox.setSpacing(50);
    hbox.setPadding(new Insets(20));





    bp1.setCenter(hbox);
    this.setTop(bp1);
}

}

0 个答案:

没有答案