当前位置: 首页>>代码示例>>Java>>正文


Java Tab.setClosable方法代码示例

本文整理汇总了Java中javafx.scene.control.Tab.setClosable方法的典型用法代码示例。如果您正苦于以下问题:Java Tab.setClosable方法的具体用法?Java Tab.setClosable怎么用?Java Tab.setClosable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.control.Tab的用法示例。


在下文中一共展示了Tab.setClosable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newTab

import javafx.scene.control.Tab; //导入方法依赖的package包/类
private Tab newTab(Dockable dockable) {
    DockKey dockKey = dockable.getDockKey();
    Tab tab = new Tab(dockKey.getName(), dockable.getComponent());
    if (dockKey.getPolicy() == TabPolicy.NotClosable) {
        tab.setClosable(false);
    }
    if (dockKey.isCloseOptionsNeeded()) {
        MenuItem closeMenuItem = new MenuItem("Close");
        closeMenuItem.setOnAction((e) -> requestClose(tab));
        ContextMenu contextMenu = new ContextMenu(closeMenuItem);
        contextMenu.showingProperty().addListener((obs, wasShowing, isNowShowing) -> {
            if (isNowShowing) {
                populateMenuItems(contextMenu, tab);
            }
        });
        tab.setContextMenu(contextMenu);
    }
    dockKey.nameProperty().addListener((event, o, n) -> tab.setText(n));
    tab.setOnClosed((event) -> {
        remove(dockable);
    });
    tab.setGraphic(dockKey.getIcon());
    tab.setOnCloseRequest((event) -> {
        desktop.fireDockableStateWillChangeEvent(dockable, State.DOCKED, State.CLOSED, event);
    });
    return tab;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:28,代码来源:TabDockingContainer.java

示例2: addNewConnectionTab

import javafx.scene.control.Tab; //导入方法依赖的package包/类
public void addNewConnectionTab() {
    int index = connectionCounter.getAndIncrement();
    AuthHandler loginHandler = loginController.generateNewHandler();
    FXMLLoader loader = new FXMLLoader(EpicApp.class.getResource("/fxml/PackageList.fxml"));
    loader.setResources(ApplicationState.getInstance().getResourceBundle());
    try {
        loader.load();
        recentConnectionTab = new Tab();
        recentConnectionTab.setContent(loader.getRoot());
        recentConnectionTab.textProperty().bind(
                Bindings.when(loginHandler.model.hostProperty().isEmpty())
                .then("New connection")
                .otherwise(loginHandler.model.hostProperty())
        );
        recentConnectionTab.setClosable(true);
        PackageListController packageListController = loader.getController();
        packageListController.setIndex(index);
        packageListController.setTab(recentConnectionTab);
        ApplicationState.getInstance().setAuthHandler(loginHandler, index);
        loginHandler.model.loginConfirmedProperty().addListener((confirmedValue, oldValue, newValue) -> this.updateConnectionTabStyle(loginHandler));
        packageListController.initAuthHandlerHooks(loginHandler);
        updateConnectionTabStyle(loginHandler);
        tabs.getTabs().add(tabs.getTabs().size() - 1, recentConnectionTab);
    } catch (IOException ex) {
        Logger.getLogger(AppController.class.getName()).log(Level.SEVERE, null, ex);
    }
    tabs.getSelectionModel().select(0);
}
 
开发者ID:Adobe-Consulting-Services,项目名称:aem-epic-tool,代码行数:29,代码来源:AppController.java

示例3: promptPassword

import javafx.scene.control.Tab; //导入方法依赖的package包/类
public void promptPassword()
{
    this.hideOpenTabs();
    
    Tab pswPane = new Tab("Root Access Required");
    pswPane.setContent(passwordPane);
    pswPane.setClosable(false);
    
    this.getTabs().add(pswPane);
    this.getSelectionModel().select(pswPane);
}
 
开发者ID:BlueGoliath,项目名称:Goliath-Overclocking-Utility-FX,代码行数:12,代码来源:AppTabPane.java

示例4: addTab

import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
 * Add a new tab and set the content as the parameter node
 * @param tabName - Tab Name
 * @param node - Content
 */
public void addTab(String tabName, Node node) {
    Tab newTab = new Tab(tabName);
    strSelectedPaneTitle = tabName;
    newTab.setContent(node);
    newTab.setClosable(true);
    getTabs().addAll(newTab);
    getSelectionModel().select(getTab(strSelectedPaneTitle));
}
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:14,代码来源:LeftBottomTabPane.java

示例5: createTab

import javafx.scene.control.Tab; //导入方法依赖的package包/类
@Override
public Tab createTab (String text, boolean closable, Node content) {
    Tab newTab = new Tab();
    newTab.setText(text);
    newTab.setClosable(closable);
    newTab.setContent(content);
    return newTab;
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:9,代码来源:BasicUIFactory.java

示例6: setTabs

import javafx.scene.control.Tab; //导入方法依赖的package包/类
public void setTabs(List<Data> data) {

        // add tabs
        for (int i = 1; i <= data.size(); i++) {
            Tab tab = new Tab("case " + i);
            tab.setClosable(false);
            tabPane.getTabs().add(tab);
        }

        // clear tabs
        tabPane.getSelectionModel().clearSelection();

        tabPane.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Tab>() {
            @Override
            public void changed(ObservableValue<? extends Tab> observable, Tab oldValue, Tab newValue) {
                if (null == newValue.getContent()) {
                    try {
                        FXMLLoader loader = new FXMLLoader();
                        loader.setLocation(getClass().getResource("../view/QuantifyStatistics.fxml"));
                        Parent root = loader.load();
                        newValue.setContent(root);

                        QuantifyStatisticsController controller = loader.getController();
                        int index = tabPane.getSelectionModel().getSelectedIndex();
                        controller.setQuantifyData(data.get(index));

                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
    }
 
开发者ID:InnoFang,项目名称:Quantify,代码行数:34,代码来源:MultiTabsDialogController.java

示例7: closeAll

import javafx.scene.control.Tab; //导入方法依赖的package包/类
public static void closeAll()
{
    int i = 0;
    while (i < TabManagement.getInstance().getTabPanes().size())
    {
        final TabPane pane = TabManagement.getInstance().getTabPanes().get(i);
        int j = 0;
        while (j < pane.getTabs().size())
        {
            final Tab tab = pane.getTabs().get(j);
            if (((BorderPane) tab.getContent()).getCenter() != null
                    && !(((BorderPane) tab.getContent()).getCenter() instanceof TextArea))
            {
                tab.setClosable(true);
                pane.getTabs().remove(j);
            }
            else
                j++;
        }
        if (pane.getTabs().size() > 0)
            TabManagement.getInstance().getTabPanes().remove(i);
        // if (pane instanceof CloseableTabPane)
        // ((CloseableTabPane) pane).hide();
        else
            i++;
    }
}
 
开发者ID:Leviathan-Studio,项目名称:MineIDE,代码行数:28,代码来源:TabHelper.java

示例8: addComponent

import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
 * Add a new component to this tool container.
 *
 * @param component the component
 * @param name      the name
 */
public void addComponent(@NotNull final Region component, @NotNull final String name) {

    final Tab tab = new Tab(name);
    tab.setContent(component);
    tab.setClosable(false);

    getTabs().add(tab);

    FXUtils.bindFixedHeight(component, heightProperty());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:17,代码来源:TabToolComponent.java

示例9: addComponent

import javafx.scene.control.Tab; //导入方法依赖的package包/类
@Override
public void addComponent(@NotNull final Region component, @NotNull final String name) {

    final ScrollPane scrollPane = new ScrollPane(new VBox(component));
    component.prefWidthProperty().bind(scrollPane.widthProperty());

    final Tab tab = new Tab(name);
    tab.setContent(scrollPane);
    tab.setClosable(false);

    getTabs().add(tab);

    FXUtils.bindFixedHeight(scrollPane, heightProperty());
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:15,代码来源:ScrollableEditorToolComponent.java

示例10: addTab

import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
 * Add a new tab and set the content as the parameter node
 * @param tabName - Tab Name
 * @param node - Content
 */
public void addTab(String tabName, Node node) {
    Tab newTab = new Tab(tabName);
    newTab.setContent(node);
    newTab.setClosable(true);
    getTabs().addAll(newTab);
}
 
开发者ID:ztan5,项目名称:TechnicalAnalysisTool,代码行数:12,代码来源:LeftUpperTabPane.java

示例11: createTagsTab

import javafx.scene.control.Tab; //导入方法依赖的package包/类
private Tab createTagsTab() {
	final Tab tagsTab = new Tab("Tags");
	tagsTab.setClosable(false);
	tagsTab.setContent(new VBox(createPredefinedTagsGrid(), CONTENT_TAGS_TABLE));
	//
	CONTENT_TAGS_TABLE.getColumns().add(TAGS_COLUMN_NAME);
	CONTENT_TAGS_TABLE.getColumns().add(TAGS_COLUMN_VALUE);
	TAGS_COLUMN_VALUE.prefWidthProperty().bind(CONTENT_TAGS_TABLE.widthProperty().subtract(TAGS_COLUMN_NAME.widthProperty()));
	TAGS_COLUMN_NAME.setCellValueFactory(cellData -> cellData.getValue().nameProperty());
	TAGS_COLUMN_VALUE.setCellValueFactory(cellData -> cellData.getValue().valueProperty());
	VBox.setVgrow(CONTENT_TAGS_TABLE, Priority.SOMETIMES);
	//
	return tagsTab;
}
 
开发者ID:mikelaud,项目名称:fx-media-catalog,代码行数:15,代码来源:FxMediaCatalog.java

示例12: MainWindow

import javafx.scene.control.Tab; //导入方法依赖的package包/类
public MainWindow(Stage primaryStage) {
    this.primaryStage = primaryStage;
    TabPane tabPane = new TabPane();
    Tab aboutTab = new Tab("About", new AboutPane(primaryStage));
    aboutTab.setClosable(false);
    Tab receiveTab = new Tab("Receive", new ReceiveNetPane(primaryStage));
    receiveTab.setClosable(false);
    Tab sendTab = new Tab("Send", new SendNetPane(primaryStage));
    sendTab.setClosable(false);
    tabPane.getTabs().addAll(aboutTab, sendTab, receiveTab);
    setCenter(tabPane);
}
 
开发者ID:luisbraganca,项目名称:file-transfer,代码行数:13,代码来源:MainWindow.java

示例13: addTab

import javafx.scene.control.Tab; //导入方法依赖的package包/类
private void addTab(String tabTitle, Node tabContent) {
	Tab tab = new Tab();
	tab.setText(tabTitle);
	tab.setContent(tabContent);
	tab.setClosable(false);
	
	center.getTabs().add(tab);
}
 
开发者ID:dhiogoboza,项目名称:SystemMonitorJFX,代码行数:9,代码来源:MainStage.java

示例14: addData

import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
 * Add a TreeMap to be controlled.
 *
 * @param treeMap the TreeMap to be added
 */
protected void addData(TreeMap treeMap) {
    AnchorPane container = createTabContent(treeMap);
    Tab tab = new Tab(treeMap.getData().getName(), container);
    tab.setClosable(false);
    tabPane.getTabs().add(tab);
}
 
开发者ID:PtitNoony,项目名称:FxTreeMap,代码行数:12,代码来源:DataControlController.java

示例15: buildTab

import javafx.scene.control.Tab; //导入方法依赖的package包/类
private Tab buildTab(String name, Node node, boolean closable) {
    Tab tab = new Tab(name);
    tab.setClosable(closable);
    tab.setContent(node);
    return tab;
}
 
开发者ID:comtel2000,项目名称:mokka7,代码行数:7,代码来源:MainViewPresenter.java


注:本文中的javafx.scene.control.Tab.setClosable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。