O'Reilly logo

JavaFX 2.0: Introduction by Example by Carl Dea

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

1-16. Adding Tabs to the UI

Problem

You want to create a GUI application with tabs.

Solution

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 the user to choose a tab orientation. The available tab orientations are top, bottom, left, and right.

    @Override     public void start(Stage primaryStage) {         primaryStage.setTitle("Chapter 1-16 Adding Tabs to a UI");         Group root = new Group();         Scene scene = new Scene(root, 400, 250, Color.WHITE);         TabPane tabPane = new TabPane();         MenuBar menuBar ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required