Java Reference
In-Depth Information
SplitPane splitPane = new SplitPane();
splitPane.prefWidthProperty().bind(scene.widthProperty());
splitPane.prefHeightProperty().bind(scene.heightProperty());
Now you create the SplitPane to divide the area vertically, which will form the
upper-right and lower-right region. Shown here is the code used to split a window re-
gion vertically:
// Upper and lower split pane
SplitPane splitPane2 = new SplitPane();
splitPane2.setOrientation(Orientation.VERTICAL);
At last you assemble the split panes and adjust the dividers to be positioned so that
the screen real estate is divided evenly. The following code assembles the split panes
and iterates through the list of dividers to update their positions:
splitPane.getItems().add(splitPane2);
// evenly position divider
ObservableList<SplitPane.Divider> dividers
= splitPane.getDividers();
for (int i = 0; i < dividers.size(); i++) {
dividers.get(i).setPosition((i + 1.0) / 3);
}
HBox hbox = new HBox();
hbox.getChildren().add(splitPane);
root.getChildren().add(hbox);
14-15. Adding Tabs to the UI
Problem
You want to create a GUI application with tabs.
Solution
Search WWH ::




Custom Search