mirror of
https://gitlab.com/kauron/jstudy
synced 2024-11-13 07:33:44 +01:00
Table: fixed bug, application now exits without .exit()
This commit is contained in:
parent
7fe80b07ec
commit
f45341d84a
2 changed files with 9 additions and 0 deletions
|
@ -77,6 +77,8 @@ public class Controller implements Initializable {
|
|||
root.getScene().getWindow().setOnCloseRequest(event -> {
|
||||
for (Tab tab : tabPane.getTabs()) {
|
||||
EventHandler<Event> handler = tab.getOnCloseRequest();
|
||||
if (tabMap.containsKey(tab))
|
||||
tabMap.get(tab).stopTimer();
|
||||
if (tab.isClosable() && handler != null) {
|
||||
tabPane.getSelectionModel().select(tab);
|
||||
handler.handle(event);
|
||||
|
|
|
@ -186,4 +186,11 @@ public class TableController implements Initializable {
|
|||
timerTask = null;
|
||||
}
|
||||
}
|
||||
|
||||
void stopTimer() {
|
||||
timer.cancel();
|
||||
timer.purge();
|
||||
if (timerTask != null)
|
||||
timerTask.cancel();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue