本文整理汇总了Java中javafx.scene.control.Tab.setDisable方法的典型用法代码示例。如果您正苦于以下问题:Java Tab.setDisable方法的具体用法?Java Tab.setDisable怎么用?Java Tab.setDisable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Tab
的用法示例。
在下文中一共展示了Tab.setDisable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createButtonTab
import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
* Create Add level button tab. This makes the UI design clean and by disabling the tab and only
* enabling the button, there won't be any awkward UI errors.
*
* @return
*/
private Tab createButtonTab () {
Tab createLevelTab = new Tab();
Button addNewLevelButton = new Button("+");
addNewLevelButton.setOnAction(e -> addNewNamedLevel());
createLevelTab.setGraphic(addNewLevelButton);
createLevelTab.setDisable(true);
createLevelTab.setClosable(false);
return createLevelTab;
}
示例2: showPrefs
import javafx.scene.control.Tab; //导入方法依赖的package包/类
/**
* Shows the preferences window.
*/
@SuppressWarnings("unchecked")
@FXML
public void showPrefs() {
TabPane tabs = new TabPane();
tabs.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
tabs.getTabs().add(new Tab("Application", new ExtendedPropertySheet(AppPreferences.getInstance().getProperties())));
for (Plugin plugin : PluginLoader.getDefault().getLoadedPlugins()) {
if (plugin.getProperties().isEmpty()) {
continue;
}
Tab tab = new Tab(plugin.getName());
tab.setContent(new ExtendedPropertySheet(plugin.getProperties()));
tab.setDisable(DashboardMode.getCurrentMode() == DashboardMode.PLAYBACK);
tabs.getTabs().add(tab);
}
Dialog<Boolean> dialog = new Dialog<>();
EasyBind.listBind(dialog.getDialogPane().getStylesheets(), root.getStylesheets());
dialog.getDialogPane().setContent(new BorderPane(tabs));
dialog.initOwner(root.getScene().getWindow());
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.initStyle(StageStyle.UTILITY);
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.CANCEL, ButtonType.OK);
dialog.setTitle("Shuffleboard Preferences");
dialog.setResizable(true);
dialog.setResultConverter(button -> !button.getButtonData().isCancelButton());
if (dialog.showAndWait().orElse(false)) {
tabs.getTabs().stream()
.map(t -> (ExtendedPropertySheet) t.getContent())
.flatMap(p -> p.getItems().stream())
.flatMap(TypeUtils.castStream(ExtendedPropertySheet.PropertyItem.class))
.map(i -> (Optional<ObservableValue>) i.getObservableValue())
.flatMap(TypeUtils.optionalStream())
.flatMap(TypeUtils.castStream(FlushableProperty.class))
.filter(FlushableProperty::isChanged)
.forEach(FlushableProperty::flush);
}
}