add And Active JavaFX Tab - Java JavaFX

Java examples for JavaFX:TabPane

Description

add And Active JavaFX Tab

Demo Code

/**//from   w ww. j a  v  a2  s.  c om
 * Author: obullxl@gmail.com
 * Copyright (c) 2004-2013 All Rights Reserved.
 */
//package com.java2s;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;

public class Main {

    public static void addAndActiveTab(TabPane tabpane, Tab tab) {
        if (tab == null) {
            return;
        }

        if (tabpane == null) {
            return;
        }

        tabpane.getTabs().add(tab);
        tabpane.getSelectionModel().select(tab);
    }
}

Related Tutorials