您應該使用Pane代替Group。
在組的JavaDoc說,
A組將在其子的集體邊界,不能直接調整大小。
編輯(每用戶評論爲)
這裏的問題是不是與窗格但TitledPane
,因爲TitledPane擴展Labeled
可以綁定titledPane的使用
在將splitPane的高度高度
titledPane1.prefHeightProperty()。bind(rootPane.heightProperty());
與TiltledPane
高度結合和其他與Pane
工作示例添加到SplitPane
public class StoreNumbers extends Application {
public void start(Stage stage) throws Exception {
Pane pane1 = new Pane();
Pane pane2 = new Pane();
TitledPane titledPane1 = new TitledPane("Panel 1", pane1);
TitledPane titledPane2 = new TitledPane("Panel 2", pane2);
SplitPane rootPane = new SplitPane();
rootPane.getItems().add(titledPane1);
rootPane.getItems().add(pane2);
Scene scene = new Scene(rootPane);
stage.setWidth(400);
stage.setHeight(300);
stage.setScene(scene);
stage.show();
pane1.setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, null, null)));
pane2.setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.SOLID, null, null)));
titledPane1.setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.DASHED, null, null)));
titledPane2.setBorder(new Border(new BorderStroke(Color.BLACK, BorderStrokeStyle.DASHED, null, null)));
titledPane1.prefHeightProperty().bind(rootPane.heightProperty());
}
public static void main(String[] args) {
launch(args);
}
}
默認情況下,可調整大小的節點將填充拆分窗格。請[發佈一些代碼](http://stackoverflow.com/help/mcve),它演示未填充拆分窗格的內容。 – jewelsea 2015-02-10 00:14:54