Java Code Examples for javafx.scene.control.Tab#setClosable()
The following examples show how to use
javafx.scene.control.Tab#setClosable() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainWindow.java From phoenicis with GNU Lesser General Public License v3.0 | 6 votes |
private Tab createContainersTab(ContainersFeaturePanel containers) { final Tab containersTab = new Tab(tr("Containers"), containers); containersTab.setClosable(false); containersTab.setOnSelectionChanged(event -> containers.getContainersManager().fetchContainers( containerCategories -> Platform.runLater(() -> { containers.getCategories().setAll(containerCategories); containers.setInitialized(true); }), e -> Platform.runLater(() -> { final ErrorDialog errorDialog = ErrorDialog.builder() .withMessage(tr("Loading containers failed.")) .withException(e) .withOwner(containers.getScene().getWindow()) .build(); errorDialog.showAndWait(); }))); return containersTab; }
Example 2
Source File: TabsRepresentation.java From phoebus with Eclipse Public License 1.0 | 6 votes |
private void addTabs(final List<TabItemProperty> added) { for (TabItemProperty item : added) { final String name = item.name().getValue(); final Pane content = new Pane(); // 'Tab's are added with a Label as 'graphic' // because that label allows setting the font. // Quirk: Tabs will not show the label unless there's also a non-empty text final Tab tab = new Tab(" ", content); final Label label = new Label(name); tab.setGraphic(label); tab.setClosable(false); // !! tab.setUserData(item); final int index = jfx_node.getTabs().size(); jfx_node.getTabs().add(tab); addChildren(index, item.children().getValue()); item.name().addPropertyListener(tab_title_listener); item.children().addPropertyListener(tab_children_listener); } }
Example 3
Source File: MainWindow.java From phoenicis with GNU Lesser General Public License v3.0 | 5 votes |
private Tab createInstallationsTab(InstallationsFeaturePanel installationsFeaturePanel) { final Tab installationsTab = new Tab(tr("Installations"), installationsFeaturePanel); installationsTab.setClosable(false); final ConcatenatedList<InstallationDTO> installations = ConcatenatedList.create( new MappedList<>(installationsFeaturePanel.getInstallationCategories(), InstallationCategoryDTO::getInstallations)); // a binding containing the number of currently active installations final IntegerBinding openInstallations = Bindings.createIntegerBinding(installations::size, installations); final TabIndicator indicator = new TabIndicator(); indicator.textProperty().bind(StringBindings.map(openInstallations, numberOfInstallations -> { if (numberOfInstallations.intValue() < 10) { return String.valueOf(numberOfInstallations); } else { return "+"; } })); // only show the tab indicator if at least one active installation exists installationsTab.graphicProperty().bind(Bindings .when(Bindings.notEqual(openInstallations, 0)) .then(indicator).otherwise(new SimpleObjectProperty<>())); return installationsTab; }
Example 4
Source File: SessionViewTool.java From VocabHunter with Apache License 2.0 | 5 votes |
public SessionViewTool(final I18nManager i18nManager) { ObservableList<Tab> tabs = tabPane.getTabs(); for (SessionTab tabDescription : SessionTab.values()) { Tab tab = new Tab(i18nManager.text(tabDescription.getKey())); tab.setId(tabDescription.getId()); tab.setClosable(false); tabs.add(tab); tabMap.put(tabDescription, tab); reverseMap.put(tab, tabDescription); } selected.bind(Bindings.createObjectBinding(this::getSelectedTab, tabPane.getSelectionModel().selectedItemProperty())); }
Example 5
Source File: ContainerInformationPanelSkin.java From phoenicis with GNU Lesser General Public License v3.0 | 5 votes |
private Tab createContainerOverviewTab() { final ContainerOverviewPanel containerOverviewPanel = new ContainerOverviewPanel(); containerOverviewPanel.containerProperty().bind( ObjectBindings.map(getControl().containerProperty(), container -> (WinePrefixContainerDTO) container)); containerOverviewPanel.onDeleteContainerProperty().bind(getControl().onDeleteContainerProperty()); containerOverviewPanel.onChangeEngineVersionProperty().bind(getControl().onChangeEngineVersionProperty()); containerOverviewPanel.onOpenFileBrowserProperty().bind(getControl().onOpenFileBrowserProperty()); final Tab containerOverviewTab = new Tab(tr("Information"), containerOverviewPanel); containerOverviewTab.setClosable(false); return containerOverviewTab; }
Example 6
Source File: ScrollableEditorToolComponent.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
@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()); }
Example 7
Source File: TabToolComponent.java From jmonkeybuilder with Apache License 2.0 | 5 votes |
/** * 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()); }
Example 8
Source File: OrsonChartsFXDemo.java From jfree-fxdemos with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void start(Stage stage) throws Exception { TabPane tabPane = new TabPane(); Tab tab1 = new Tab(); tab1.setText("Demos"); tab1.setClosable(false); SplitPane sp = new SplitPane(); final StackPane sp1 = new StackPane(); sp1.getChildren().add(createTreeView()); final BorderPane sp2 = new BorderPane(); sp2.setCenter(createChartPane()); sp.getItems().addAll(sp1, sp2); sp.setDividerPositions(0.3f, 0.6f); tab1.setContent(sp); tabPane.getTabs().add(tab1); Tab tab2 = new Tab(); tab2.setText("About"); tab2.setClosable(false); WebView browser = new WebView(); WebEngine webEngine = browser.getEngine(); webEngine.load(getClass().getResource("/org/jfree/chart3d/fx/demo/about.html").toString()); tab2.setContent(browser); tabPane.getTabs().add(tab2); Scene scene = new Scene(tabPane, 1024, 768); stage.setScene(scene); stage.setTitle("Orson Charts JavaFX Demo"); stage.show(); }
Example 9
Source File: ViewportTabs.java From Recaf with MIT License | 5 votes |
private Tab createTab(String name, EditorViewport view) { // Normalize name String title = name; if(title.contains("/")) title = title.substring(title.lastIndexOf("/") + 1); Tab tab = new Tab(title, view); tab.setClosable(true); // Name lookup tab.setOnClosed(o -> nameToTab.remove(name)); nameToTab.put(name, tab); // Add and return getTabs().add(tab); return tab; }
Example 10
Source File: RegexConfigFragment.java From mdict-java with GNU General Public License v3.0 | 4 votes |
@SuppressWarnings("unchecked") public RegexConfigFragment(PlainDictAppOptions _opt){ super(); tabPane = new TabPane(); statusBar = new Text(); tabPane.setPadding(new Insets(4,0,0,0)); opt=_opt; bundle = ResourceBundle.getBundle("UIText", Locale.getDefault()); Tab tab1 = new Tab(); tab1.setText(bundle.getString(onegine)); tab1.setTooltip(new Tooltip("词条、全文检索时,可选用正则引擎,或快速 .* 通配")); tab1.setClosable(false); Text lable = new Text(""); lable.setStyle("-fx-fill: #ff0000;"); tab1.setGraphic(lable); Tab tab2 = new Tab(); tab2.setText(bundle.getString(findpage)); tab2.setTooltip(new Tooltip("基于 Mark.js")); tab2.setClosable(false); Text lable1 = new Text(""); lable1.setStyle("-fx-fill: #ff0000;"); tab2.setGraphic(lable1); tabPane.getSelectionModel().selectedIndexProperty().addListener((observable, oldValue, newValue) -> { if(newValue.intValue()==1){ if(tab2.getContent()==null) tab2.setContent(getSubpageContent()); } }); tabPane.setRotateGraphic(false); tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.SELECTED_TAB); tabPane.setSide(Side.TOP); tabPane.getTabs().addAll(tab1,tab2); tabPane.getStyleClass().add(TabPane.STYLE_CLASS_FLOATING); final String lvCss = HiddenSplitPaneApp.class.getResource("lvCss.css").toExternalForm(); tabPane.getStylesheets().add(lvCss); tab1.setContent(getMainContent()); VBox.setVgrow(tabPane, Priority.ALWAYS); getChildren().addAll(tabPane, statusBar); }
Example 11
Source File: ClientLoginNode.java From helloiot with GNU General Public License v3.0 | 4 votes |
void onAddDeviceUnit(ActionEvent event) { DialogView dialog = new DialogView(); List<TopicsTab> topicstabadd = new ArrayList<>(); TabPane tabadd = new TabPane(); tabadd.getStyleClass().add("unittabpane"); tabadd.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE); Consumer<ActionEvent> actionok = evOK -> { TopicsTab tt = topicstabadd.get(tabadd.getSelectionModel().getSelectedIndex()); DialogView loading3 = Dialogs.createLoading(); loading3.show(MessageUtils.getRoot(rootpane)); CompletableAsync.handle( tt.createSelected(), result -> { loading3.dispose(); devicesunitsitems.add(result); devicesunitsselection.select(result); }, ex -> { loading3.dispose(); MessageUtils.showException(MessageUtils.getRoot(rootpane), resources.getString("title.new"), resources.getString("exception.cannotloadunit"), ex); }); }; // Create Tab TopicsTab topicstab0 = new TopicsGallery(); topicstab0.setActionOK(actionok.andThen(e -> dialog.dispose())); // ADD Tab topicstabadd.add(topicstab0); Tab tab0 = new Tab(topicstab0.getText(), topicstab0.getNode()); tab0.setClosable(false); // Create Tab TopicsTab topicstab1 = new TopicsTemplate(); topicstab1.setActionOK(actionok.andThen(e -> dialog.dispose())); // Add Tab topicstabadd.add(topicstab1); Tab tab1 = new Tab(topicstab1.getText(), topicstab1.getNode()); tab1.setClosable(false); tabadd.getTabs().addAll(tab0, tab1); dialog.setCSS("/com/adr/helloiot/styles/topicinfodialog.css"); dialog.setTitle(resources.getString("title.new")); dialog.setContent(tabadd); dialog.addButtons(dialog.createCancelButton(), dialog.createOKButton()); dialog.show(MessageUtils.getRoot(rootpane)); dialog.setActionOK(actionok); }
Example 12
Source File: DaoView.java From bisq with GNU Affero General Public License v3.0 | 4 votes |
@Override public void initialize() { factsAndFiguresTab = new Tab(Res.get("dao.tab.factsAndFigures").toUpperCase()); bsqWalletTab = new Tab(Res.get("dao.tab.bsqWallet").toUpperCase()); proposalsTab = new Tab(Res.get("dao.tab.proposals").toUpperCase()); bondingTab = new Tab(Res.get("dao.tab.bonding").toUpperCase()); burnBsqTab = new Tab(Res.get("dao.tab.proofOfBurn").toUpperCase()); monitorTab = new Tab(Res.get("dao.tab.monitor").toUpperCase()); factsAndFiguresTab.setClosable(false); bsqWalletTab.setClosable(false); proposalsTab.setClosable(false); bondingTab.setClosable(false); burnBsqTab.setClosable(false); monitorTab.setClosable(false); if (!DevEnv.isDaoActivated()) { factsAndFiguresTab.setDisable(true); bsqWalletTab.setDisable(true); proposalsTab.setDisable(true); bondingTab.setDisable(true); burnBsqTab.setDisable(true); monitorTab.setDisable(true); daoNewsTab = new Tab(Res.get("dao.tab.news").toUpperCase()); root.getTabs().add(daoNewsTab); } else { root.getTabs().addAll(factsAndFiguresTab, bsqWalletTab, proposalsTab, bondingTab, burnBsqTab, monitorTab); } navigationListener = viewPath -> { if (viewPath.size() == 3 && viewPath.indexOf(DaoView.class) == 1) { if (proposalsTab == null && viewPath.get(2).equals(EconomyView.class)) navigation.navigateTo(MainView.class, DaoView.class, EconomyView.class); else loadView(viewPath.tip()); } }; tabChangeListener = (ov, oldValue, newValue) -> { if (newValue == bsqWalletTab) { Class<? extends View> selectedViewClass = bsqWalletView != null ? bsqWalletView.getSelectedViewClass() : null; if (selectedViewClass == null) navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, BsqSendView.class); else navigation.navigateTo(MainView.class, DaoView.class, BsqWalletView.class, selectedViewClass); } else if (newValue == proposalsTab) { navigation.navigateTo(MainView.class, DaoView.class, GovernanceView.class); } else if (newValue == bondingTab) { navigation.navigateTo(MainView.class, DaoView.class, BondingView.class); } else if (newValue == burnBsqTab) { navigation.navigateTo(MainView.class, DaoView.class, BurnBsqView.class); } else if (newValue == factsAndFiguresTab) { navigation.navigateTo(MainView.class, DaoView.class, EconomyView.class); } else if (newValue == monitorTab) { navigation.navigateTo(MainView.class, DaoView.class, MonitorView.class); } }; }
Example 13
Source File: TabDemo.java From phoebus with Eclipse Public License 1.0 | 4 votes |
@Override public void start(final Stage stage) { // TabPane with some tabs final TabPane tabs = new TabPane(); tabs.setStyle("-fx-background-color: red;"); for (int i=0; i<3; ++i) { final Rectangle rect = new Rectangle(i*100, 100, 10+i*100, 20+i*80); rect.setFill(Color.BLUE); final Pane content = new Pane(rect); final Tab tab = new Tab("Tab " + (i+1), content); tab.setClosable(false); tabs.getTabs().add(tab); } tabs.setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE); tabs.setPrefSize(400, 300); final Group widgets = new Group(tabs); widgets.setScaleX(0.5); widgets.setScaleY(0.5); final Group scroll_content = new Group(widgets); final ScrollPane scroll = new ScrollPane(scroll_content); final Scene scene = new Scene(scroll); stage.setTitle("Tab Demo"); stage.setScene(scene); stage.show(); // Unfortunately, the setup of ScrollPane -> Group -> Group -> TabPane // breaks the rendering of the TabPane. // While the red background shows the area occupied by TabPane, // the actual Tabs are missing.. System.out.println("See anything?"); scene.addEventFilter(KeyEvent.KEY_PRESSED, (KeyEvent event) -> { if (event.getCode() == KeyCode.SPACE) { // .. until 'side' or 'tabMinWidth' or .. are twiddled to force a refresh tabs.setSide(Side.BOTTOM); tabs.setSide(Side.TOP); System.out.println("See it now?"); } }); }
Example 14
Source File: MainViewPresenter.java From mokka7 with Eclipse Public License 1.0 | 4 votes |
private Tab buildTab(String name, Node node, boolean closable) { Tab tab = new Tab(name); tab.setClosable(closable); tab.setContent(node); return tab; }
Example 15
Source File: LibraryPanel.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Create a new library panel. */ public LibraryPanel() { LOGGER.log(Level.INFO, "Creating library panel"); tabPane = new TabPane(); LOGGER.log(Level.INFO, "Creating library song panel"); songPanel = new LibrarySongPanel(); Tab songTab = new Tab(); songTab.setClosable(false); songTab.setText(LabelGrabber.INSTANCE.getLabel("library.songs.heading")); songTab.setContent(songPanel); tabPane.getTabs().add(songTab); LOGGER.log(Level.INFO, "Creating library bible panel"); biblePanel = new LibraryBiblePanel(); Tab bibleTab = new Tab(); bibleTab.setClosable(false); bibleTab.setText(LabelGrabber.INSTANCE.getLabel("library.bible.heading")); bibleTab.setContent(biblePanel); tabPane.getTabs().add(bibleTab); LOGGER.log(Level.INFO, "Creating library image panel"); imagePanel = new LibraryImagePanel(); Tab imageTab = new Tab(); imageTab.setClosable(false); imageTab.setText(LabelGrabber.INSTANCE.getLabel("library.image.heading")); imageTab.setContent(imagePanel); tabPane.getTabs().add(imageTab); if (QueleaProperties.get().getDisplayVideoTab()) { LOGGER.log(Level.INFO, "Creating library video panel"); videoPanel = new LibraryVideoPanel(); Tab videoTab = new Tab(); videoTab.setClosable(false); videoTab.setText(LabelGrabber.INSTANCE.getLabel("library.video.heading")); videoTab.setContent(videoPanel); tabPane.getTabs().add(videoTab); } else { videoPanel = null; } LOGGER.log(Level.INFO, "Creating library timer panel"); timerPanel = new LibraryTimerPanel(); timerTab = new Tab(); timerTab.setClosable(false); timerTab.setText(LabelGrabber.INSTANCE.getLabel("library.timer.heading")); timerTab.setContent(timerPanel); if (QueleaProperties.get().getTimerDir().listFiles() != null && QueleaProperties.get().getTimerDir().listFiles().length > 0) { tabPane.getTabs().add(timerTab); } VBox.setVgrow(tabPane, Priority.ALWAYS); getChildren().add(tabPane); }
Example 16
Source File: SongEntryWindow.java From Quelea with GNU General Public License v3.0 | 4 votes |
/** * Create and initialise the new song window. */ public SongEntryWindow() { initModality(Modality.APPLICATION_MODAL); updateDBOnHide = true; Utils.addIconsToStage(this); confirmButton = new Button(LabelGrabber.INSTANCE.getLabel("add.song.button"), new ImageView(new Image("file:icons/tick.png"))); BorderPane mainPane = new BorderPane(); tabPane = new TabPane(); setupBasicSongPanel(); Tab basicTab = new Tab(LabelGrabber.INSTANCE.getLabel("basic.information.heading")); basicTab.setContent(basicSongPanel); basicTab.setClosable(false); tabPane.getTabs().add(basicTab); setupDetailedSongPanel(); Tab detailedTab = new Tab(LabelGrabber.INSTANCE.getLabel("detailed.info.heading")); detailedTab.setContent(detailedSongPanel); detailedTab.setClosable(false); tabPane.getTabs().add(detailedTab); setupTranslatePanel(); Tab translateTab = new Tab(LabelGrabber.INSTANCE.getLabel("translate.heading")); translateTab.setContent(translatePanel); translateTab.setClosable(false); tabPane.getTabs().add(translateTab); basicSongPanel.getLyricsField().getTextArea().textProperty().addListener((observable, oldValue, newValue) -> { if(!disableTextAreaListeners) { disableTextAreaListeners = true; translatePanel.getDefaultLyricsArea().getTextArea().replaceText(newValue); disableTextAreaListeners = false; } }); translatePanel.getDefaultLyricsArea().getTextArea().textProperty().addListener((observable, oldValue, newValue) -> { if(!disableTextAreaListeners) { disableTextAreaListeners = true; basicSongPanel.getLyricsField().getTextArea().replaceText(newValue); disableTextAreaListeners = false; } }); setupThemePanel(); Tab themeTab = new Tab(LabelGrabber.INSTANCE.getLabel("theme.heading")); themeTab.setContent(themePanel); themeTab.setClosable(false); tabPane.getTabs().add(themeTab); mainPane.setCenter(tabPane); confirmButton.setOnAction(t -> { cancel = false; saveSong(); }); cancelButton = new Button(LabelGrabber.INSTANCE.getLabel("cancel.button"), new ImageView(new Image("file:icons/cross.png"))); cancelButton.setOnAction(t -> { checkSave(); }); addToSchedCBox = new CheckBox(LabelGrabber.INSTANCE.getLabel("add.to.schedule.text")); HBox checkBoxPanel = new HBox(); HBox.setMargin(addToSchedCBox, new Insets(0, 0, 0, 10)); checkBoxPanel.getChildren().add(addToSchedCBox); VBox bottomPanel = new VBox(); bottomPanel.setSpacing(5); HBox buttonPanel = new HBox(); buttonPanel.setSpacing(10); buttonPanel.setAlignment(Pos.CENTER); buttonPanel.getChildren().add(confirmButton); buttonPanel.getChildren().add(cancelButton); bottomPanel.getChildren().add(checkBoxPanel); bottomPanel.getChildren().add(buttonPanel); BorderPane.setMargin(bottomPanel, new Insets(10, 0, 5, 0)); mainPane.setBottom(bottomPanel); setOnShowing(t -> { cancel = true; }); setOnCloseRequest(t -> { checkSave(); }); Scene scene = new Scene(mainPane); if (QueleaProperties.get().getUseDarkTheme()) { scene.getStylesheets().add("org/modena_dark.css"); } setScene(scene); }
Example 17
Source File: ContainerInformationPanelSkin.java From phoenicis with GNU Lesser General Public License v3.0 | 3 votes |
private Tab createContainerVerbsTab() { final ContainerVerbsPanel containerVerbsPanel = new ContainerVerbsPanel(); containerVerbsPanel.containerProperty().bind(getControl().containerProperty()); containerVerbsPanel.verbsProperty().bind(getControl().verbsProperty()); containerVerbsPanel.verbsManagerProperty().bind(getControl().verbsManagerProperty()); final Tab verbsTab = new Tab(tr(tr("Verbs")), containerVerbsPanel); verbsTab.setClosable(false); return verbsTab; }
Example 18
Source File: ContainerInformationPanelSkin.java From phoenicis with GNU Lesser General Public License v3.0 | 3 votes |
private Tab createContainerToolsTab() { final ContainerToolsPanel containerToolsPanel = new ContainerToolsPanel(); containerToolsPanel.containerProperty().bind(getControl().containerProperty()); containerToolsPanel.enginesManagerProperty().bind(getControl().enginesManagerProperty()); final Tab containerToolsTab = new Tab(tr("Tools"), containerToolsPanel); containerToolsTab.setClosable(false); return containerToolsTab; }
Example 19
Source File: MainWindow.java From phoenicis with GNU Lesser General Public License v3.0 | 3 votes |
private Tab createLibraryTab(LibraryFeaturePanel library) { final Tab libraryTab = new Tab(tr("Library"), library); libraryTab.setClosable(false); return libraryTab; }
Example 20
Source File: MainWindow.java From phoenicis with GNU Lesser General Public License v3.0 | 3 votes |
private Tab createApplicationsTab(ApplicationsFeaturePanel apps) { final Tab applicationsTab = new Tab(tr("Apps"), apps); applicationsTab.setClosable(false); return applicationsTab; }