本文整理汇总了Java中javafx.scene.control.Tab.setOnClosed方法的典型用法代码示例。如果您正苦于以下问题:Java Tab.setOnClosed方法的具体用法?Java Tab.setOnClosed怎么用?Java Tab.setOnClosed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Tab
的用法示例。
在下文中一共展示了Tab.setOnClosed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createNewTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
* Creates a new tab for the web browser ->Directing to a specific web site [[SuppressWarningsSpartan]]
*
* @param webSite
*/
public WebBrowserTabController createNewTab(String... webSite) {
//Create
Tab tab = new Tab("");
WebBrowserTabController webBrowserTab = new WebBrowserTabController(this, tab, webSite.length == 0 ? null : webSite[0]);
tab.setOnClosed(c -> {
//Check the tabs number
if (tabPane.getTabs().isEmpty())
createAndAddNewTab();
// Delete cache for navigate back
webBrowserTab.webEngine.load("about:blank");
//Delete cookies Experimental!!!
//java.net.CookieHandler.setDefault(new java.net.CookieManager())
});
return webBrowserTab;
}
示例2: 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;
}
示例3: displayLevel
import javafx.scene.control.Tab; //导入方法依赖的package包/类
private void displayLevel (String name, ILevel level) {
LevelEditorView view =
new LevelEditorView(myGame, level);
myViews.add(view);
Tab newLevelTab =
myUIFactory.createTabText(name, true, view.draw());
newLevelTab.setOnClosed(e -> remove(level, view));
myLevelTabs.getTabs().add(newLevelTab);
}
示例4: addNewLevel
import javafx.scene.control.Tab; //导入方法依赖的package包/类
private void addNewLevel (String name, ILevel newLevel) {
newLevel.setProfile(new Profile(name));
myLevelManager.createNewLevel(newLevel);
LevelEditorView view =
new LevelEditorView(myGame, newLevel);
myViews.add(view);
Tab newLevelTab =
myUIFactory.createTabText(name, true, view.draw());
newLevelTab.setOnClosed(e -> remove(newLevel, view));
myLevelTabs.getTabs().add(newLevelTab);
myLevelTabs.getSelectionModel().select(newLevelTab);
}