Skip to content

Commit 8c8e71e

Browse files
committed
Fixed add tab button
1 parent da38772 commit 8c8e71e

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

.idea/workspace.xml

Lines changed: 11 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/org/idaesbasic/controllers/MainController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ void initialize() {
8484
public void changed(ObservableValue<? extends Tab> observable, Tab oldTab, Tab newTab) {
8585
if(newTab.equals (plusTab)) {
8686
addNewTab();
87-
tabPane.getTabs().remove(plusTab);
88-
tabPane.getTabs().add(plusTab);
8987
}
9088
}
9189
});
@@ -325,6 +323,9 @@ void addNewTab() {
325323
// Select the tab
326324
SingleSelectionModel<Tab> selectionModel = tabPane.getSelectionModel();
327325
selectionModel.select(newTab);
326+
// Remove and re-add the "add tab" tab, to have it always as last tab
327+
tabPane.getTabs().remove(plusTab);
328+
tabPane.getTabs().add(plusTab);
328329
}
329330

330331
@FXML
@@ -339,6 +340,7 @@ void closeCurrentTab(ActionEvent event) {
339340
void closeAllTabs(ActionEvent event) {
340341
// Close all tabs of tabpane
341342
tabPane.getTabs().clear();
343+
tabPane.getTabs().add(plusTab);
342344
}
343345

344346
@FXML

0 commit comments

Comments
 (0)