1
這是我編寫的代碼,但寬度未設置爲VBox項目。我得到所有面板相同的大小。我需要一些幫助。 在此先感謝!寬度是不是爲javafx VBox項目設置?
private void initComponents() {
this.setPadding(new Insets(0,70,0,70));
this.setSpacing(10);
red1 = new StackPane();
red1.setStyle("-fx-background-color:red;");
red1.setPrefHeight(60);
red1.setPrefWidth(260);
this.setVgrow(red1, Priority.ALWAYS);
this.getChildren().add(red1);
red2 = new StackPane();
red2.setStyle("-fx-background-color:red;");
red2.setPrefHeight(60);
red2.setPrefWidth(240);
this.setVgrow(red2, Priority.ALWAYS);
this.getChildren().add(red2);
}
private StackPane red1;
private StackPane red2;
}
它的工作原理,thanx! – JanithOCoder