List of usage examples for javafx.scene.control Tab closableProperty
public final BooleanProperty closableProperty()
From source file:com.esri.geoevent.test.performance.ui.OrchestratorController.java
private void addFixtureTab(final Fixture fixture, boolean isDefault) { try {//from www.j a v a 2s . c o m FXMLLoader loader = new FXMLLoader(getClass().getResource("Fixture.fxml")); Parent fixtureTab = (Parent) loader.load(); FixtureController controller = loader.getController(); controller.setFixture(fixture); controller.setIsDefault(isDefault); Tab newTab = new Tab(fixture.getName()); newTab.setContent(fixtureTab); newTab.closableProperty().setValue(!isDefault); newTab.setOnCloseRequest(event -> { boolean isOkClicked = showConfirmationDialog( UIMessages.getMessage("UI_CLOSE_TAB_LABEL", fixture.getName())); if (!isOkClicked) { event.consume(); } else { fixtures.getFixtures().remove(fixture); } }); fixtureTabPane.getTabs().add(newTab); } catch (IOException e) { e.printStackTrace(); } }