Java Reference
In-Depth Information
Use JavaFX's tab and tab pane control. The tab ( javafx.scene.control.Tab )
and tab pane control ( javafx.scene.control.TabPane ) classes allow you to
place graph nodes in individual tabs.
The following code example creates a simple application having menu options that
allow users to choose a tab orientation. The available tab orientations are top, bottom,
left, and right.
public void start(Stage primaryStage) {
primaryStage.setTitle("Chapter 14-15 Adding Tabs to
a UI");
Group root = new Group();
Scene scene = new Scene(root, 400, 250, Color.WHITE);
TabPane tabPane = new TabPane();
MenuBar menuBar = new MenuBar();
EventHandler<ActionEvent> action
= changeTabPlacement(tabPane);
Menu menu = new Menu("Tab Side");
MenuItem left = new MenuItem("Left");
left.setOnAction(action);
menu.getItems().add(left);
MenuItem right = new MenuItem("Right");
right.setOnAction(action);
menu.getItems().add(right);
MenuItem top = new MenuItem("Top");
top.setOnAction(action);
menu.getItems().add(top);
MenuItem bottom = new MenuItem("Bottom");
bottom.setOnAction(action);
menu.getItems().add(bottom);
Search WWH ::




Custom Search