List of usage examples for javafx.application Platform isImplicitExit
public static boolean isImplicitExit()
From source file:org.cryptomator.ui.ExitUtil.java
private void initMinimizeExitHandler(Runnable exitCommand) { mainWindow.setOnCloseRequest(e -> { if (Platform.isImplicitExit()) { exitCommand.run();/*from w ww . j a va 2 s . com*/ } else { mainWindow.setIconified(true); e.consume(); } }); }
From source file:org.cryptomator.ui.ExitUtil.java
private void initTrayIconExitHandler(Runnable exitCommand) { final TrayIcon trayIcon = createTrayIcon(exitCommand); try {//from www .ja v a2 s . c om // double clicking tray icon should open Cryptomator if (SystemUtils.IS_OS_WINDOWS) { trayIcon.addMouseListener(new TrayIconMouseListener()); } SystemTray.getSystemTray().add(trayIcon); mainWindow.setOnCloseRequest((e) -> { if (Platform.isImplicitExit()) { exitCommand.run(); } else { macFunctions.map(MacFunctions::uiState) .ifPresent(JniException.ignore(MacApplicationUiState::transformToAgentApplication)); mainWindow.close(); this.showTrayNotification(trayIcon); } }); } catch (SecurityException | AWTException ex) { // not working? then just go ahead and close the app mainWindow.setOnCloseRequest((ev) -> { exitCommand.run(); }); } }