List of usage examples for javafx.scene.control Tab Tab
public Tab(String text)
From source file:org.beryx.viewreka.fxapp.Viewreka.java
public void refreshViews() { if (project == null) return;//from w w w .j a v a 2 s. c om project.getProjectSettingsManager().saveSettings(); viewsTabPane.getTabs().clear(); ProjectSettings projectSettings = project.getProjectSettingsManager().getSettings(); String currentViewName = projectSettings.getCurrentView(); Tab selectedTab = null; for (FxView view : project.getViews()) { String viewName = view.getName(); final Tab tab = new Tab(viewName); viewsTabPane.getTabs().add(tab); if (viewName.equals(currentViewName)) { selectedTab = tab; } final ViewPane<?> viewPane = ViewPane.fromModel(view, projectSettings); tab.setContent(viewPane); viewPane.autosize(); tab.setOnSelectionChanged(new EventHandler<Event>() { @Override public void handle(Event event) { viewPane.autosize(); Tab selTab = viewsTabPane.getSelectionModel().getSelectedItem(); if (selTab != null) { String selectedView = selTab.getText(); projectSettings.setCurrentView(selectedView); } } }); } if (selectedTab != null) { viewsTabPane.getSelectionModel().select(selectedTab); } layout(); }