Java Code Examples for javafx.application.Platform#exit()
The following examples show how to use
javafx.application.Platform#exit() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScreensSwitcher.java From mars-sim with GNU General Public License v3.0 | 6 votes |
public boolean exitDialog(Stage stage) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.initOwner(stage); alert.setTitle("Confirmation for Exit");//("Confirmation Dialog"); alert.setHeaderText("Leaving mars-sim ?"); //alert.initModality(Modality.APPLICATION_MODAL); alert.setContentText("Note: Yes to exit mars-sim"); ButtonType buttonTypeYes = new ButtonType("Yes"); ButtonType buttonTypeNo = new ButtonType("No"); alert.getButtonTypes().setAll(buttonTypeYes, buttonTypeNo); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == buttonTypeYes){ if (mainMenu.getMultiplayerMode() != null) if (mainMenu.getMultiplayerMode().getChoiceDialog() != null) mainMenu.getMultiplayerMode().getChoiceDialog().close(); alert.close(); Platform.exit(); System.exit(0); return true; } else { alert.close(); return false; } }
Example 2
Source File: UI.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
public void quit() { globalHotkey.quit(); if (browserComponent != null) { browserComponent.onAppQuit(); } if (!TestController.isTestMode() || TestController.isTestGlobalConfig()) { panels.saveSession(); } if (!TestController.isTestMode() || TestController.isCloseOnQuit()) { updateManager.onAppQuit(); Platform.exit(); System.exit(0); } }
Example 3
Source File: BlendEffect.java From Learn-Java-12-Programming with MIT License | 5 votes |
@Override public void run(){ try { for(String effect: effects){ for(int i = 0; i < 11; i++){ double opacity = Math.round(i * 0.1 * 10.0) / 10.0; System.out.println(effect + " = " + opacity); String[] e = effect.split(","); txt1.setText("The blend mode opacity: " + opacity); txt2.setText(e[0]); txt3.setText(e[1]); Blend b1 = new Blend(); BlendMode bm1 = Enum.valueOf(BlendMode.class, e[0]); b1.setMode(bm1); b1.setOpacity(opacity); g1.setEffect(b1); Blend b2 = new Blend(); BlendMode bm2 = Enum.valueOf(BlendMode.class, e[1]); b2.setMode(bm2); b2.setOpacity(opacity); g2.setEffect(b2); TimeUnit.SECONDS.sleep(1); if(pause){ while(true){ TimeUnit.SECONDS.sleep(1); if(!pause){ break; } } } } } Platform.exit(); } catch (Exception ex){ ex.printStackTrace(); } }
Example 4
Source File: GuiUtils.java From thundernetwork with GNU Affero General Public License v3.0 | 5 votes |
public static void crashAlert(Throwable t) { t.printStackTrace(); Throwable rootCause = Throwables.getRootCause(t); Runnable r = () -> { runAlert((stage, controller) -> controller.crashAlert(stage, rootCause.toString())); Platform.exit(); }; if (Platform.isFxApplicationThread()) r.run(); else Platform.runLater(r); }
Example 5
Source File: Controller.java From uip-pc2 with MIT License | 5 votes |
public void salir(ActionEvent actionEvent) { Alert alerta = new Alert(Alert.AlertType.CONFIRMATION); alerta.setTitle("Pa lante!"); alerta.setContentText("Seguro que te quieres ir"); alerta.setHeaderText("Intento de fuga"); Optional<ButtonType> resultado = alerta.showAndWait(); if (resultado.get() == ButtonType.OK) { Platform.exit(); } int x = Integer.parseInt(campoblanco.getText()); }
Example 6
Source File: NewFXPreloader.java From Path-of-Leveling with MIT License | 5 votes |
@Override public void handleApplicationNotification(PreloaderNotification arg0) { if (arg0 instanceof ProgressNotification) { ProgressNotification pn= (ProgressNotification) arg0; controller.notify(pn.getProgress()); } else if (arg0 instanceof ErrorNotification) { new Alert(Alert.AlertType.ERROR, ((ErrorNotification) arg0).getDetails(), ButtonType.OK).showAndWait(); Platform.exit(); System.exit(1); } else if (arg0 instanceof GemDownloadNotification){ GemDownloadNotification err = (GemDownloadNotification) arg0; controller.gemDownload(err.getGemName()); } }
Example 7
Source File: WebViewBootstrap.java From nuls with MIT License | 4 votes |
public void exit() { SystemTray.getSystemTray().remove(trayIcon); Platform.exit(); }
Example 8
Source File: Controller.java From uip-pc2 with MIT License | 4 votes |
public void salir(ActionEvent actionEvent) { Platform.exit(); }
Example 9
Source File: MainScene.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void exit() { endSim(); exitSimulation(); Platform.exit(); System.exit(0); }
Example 10
Source File: ExitAction.java From jmonkeybuilder with Apache License 2.0 | 4 votes |
/** * Exit. */ private void process() { Platform.exit(); }
Example 11
Source File: JarUpdater.java From HubTurbo with GNU Lesser General Public License v3.0 | 4 votes |
public void quit() { Platform.exit(); System.exit(0); }
Example 12
Source File: Main.java From thundernetwork with GNU Affero General Public License v3.0 | 4 votes |
private void realStart (Stage mainWindow) throws IOException { this.mainWindow = mainWindow; instance = this; // Show the crash dialog for any exceptions that we don't handle and that hit the main loop. GuiUtils.handleCrashesOnThisThread(); // Load the GUI. The MainController class will be automagically created and wired up. File file = new File("main.fxml"); URL location = getClass().getResource("main.fxml"); FXMLLoader loader = new FXMLLoader(location); mainUI = loader.load(); controller = loader.getController(); // Configure the window with a StackPane so we can overlay things on top of the main UI, and a // NotificationBarPane so we can slide messages and progress bars in from the bottom. Note that // ordering of the construction and connection matters here, otherwise we get (harmless) CSS error // spew to the logs. notificationBar = new NotificationBarPane(mainUI); mainWindow.setTitle(APP_NAME); uiStack = new StackPane(); Scene scene = new Scene(uiStack); TextFieldValidator.configureScene(scene); // Add CSS that we need. scene.getStylesheets().add(getClass().getResource("wallet.css").toString()); uiStack.getChildren().add(notificationBar); mainWindow.setScene(scene); // Make log output concise. BriefLogFormatter.init(); // Tell bitcoinj to run event handlers on the JavaFX UI thread. This keeps things simple and means // we cannot forget to switch threads when adding event handlers. Unfortunately, the DownloadListener // we give to the app kit is currently an exception and runs on a library thread. It'll get fixed in // a future version. Threading.USER_THREAD = Platform::runLater; // Create the app kit. It won't do any heavyweight initialization until after we start it. setupWalletKit(null); if (bitcoin.isChainFileLocked()) { if (REQUEST != null) { PaymentProtocolClientSocket.sendPaymentRequest(REQUEST); Platform.exit(); return; } informationalAlert("Already running", "This application is already running and cannot be started twice."); Platform.exit(); return; } PaymentProtocolServerSocket.init(); mainWindow.show(); WalletSetPasswordController.estimateKeyDerivationTimeMsec(); bitcoin.addListener(new Service.Listener() { @Override public void failed (Service.State from, Throwable failure) { GuiUtils.crashAlert(failure); } }, Platform::runLater); bitcoin.startAsync(); System.out.println("init"); node.init(); wallet = new MockWallet(Constants.getNetwork()); thunderContext = new ThunderContext(wallet, dbHandler, node); thunderContext.startUp(new NullResultCommand()); scene.getAccelerators().put(KeyCombination.valueOf("Shortcut+F"), () -> bitcoin.peerGroup().getDownloadPeer().close()); }
Example 13
Source File: Controller.java From uip-pc2 with MIT License | 4 votes |
public void salir(ActionEvent actionEvent) { Platform.exit(); }
Example 14
Source File: MainViewController.java From examples-javafx-repos1 with Apache License 2.0 | 4 votes |
@FXML public void exit() { Platform.exit(); }
Example 15
Source File: DashBoardUIController.java From RentLio with Apache License 2.0 | 4 votes |
@FXML private void windowClose() { Platform.exit(); }
Example 16
Source File: Secundario.java From uip-pc2 with MIT License | 4 votes |
@FXML private void salir(ActionEvent actionEvent) { Platform.exit(); }
Example 17
Source File: MZmineGUI.java From mzmine3 with GNU General Public License v2.0 | 4 votes |
@Override public void start(Stage stage) { MZmineGUI.mainStage = stage; MZmineCore.setDesktop(this); logger.finest("Initializing MZmine main window"); try { // Load the main window URL mainFXML = this.getClass().getResource(mzMineFXML); FXMLLoader loader = new FXMLLoader(mainFXML); rootScene = loader.load(); mainWindowController = loader.getController(); stage.setScene(rootScene); } catch (Exception e) { e.printStackTrace(); logger.severe("Error loading MZmine GUI from FXML: " + e); Platform.exit(); } stage.setTitle("MZmine " + MZmineCore.getMZmineVersion()); stage.setMinWidth(600); stage.setMinHeight(400); // Set application icon stage.getIcons().setAll(mzMineIcon); stage.setOnCloseRequest(e -> { requestQuit(); e.consume(); }); // Drag over surface rootScene.setOnDragOver(MZmineGUI::activateSetOnDragOver); // Dropping over surface rootScene.setOnDragDropped(MZmineGUI::activateSetOnDragDropped); // Configure desktop properties such as the application taskbar icon // on a new thread. It is important to start this thread after the // JavaFX subsystem has started. Otherwise we could be treated like a // Swing application. Thread desktopSetupThread = new Thread(new DesktopSetup()); desktopSetupThread.setPriority(Thread.MIN_PRIORITY); desktopSetupThread.start(); setStatusBarText("Welcome to MZmine " + MZmineCore.getMZmineVersion()); stage.show(); // update the size and position of the main window /* * ParameterSet paramSet = configuration.getPreferences(); WindowSettingsParameter settings = * paramSet .getParameter(MZminePreferences.windowSetttings); * settings.applySettingsToWindow(desktop.getMainWindow()); */ // add last project menu items /* * if (desktop instanceof MainWindow) { ((MainWindow) desktop).createLastUsedProjectsMenu( * configuration.getLastProjects()); // listen for changes * configuration.getLastProjectsParameter() .addFileListChangedListener(list -> { // new list of * last used projects Desktop desk = getDesktop(); if (desk instanceof MainWindow) { * ((MainWindow) desk) .createLastUsedProjectsMenu(list); } }); } */ // Activate project - bind it to the desktop's project tree MZmineProjectImpl currentProject = (MZmineProjectImpl) MZmineCore.getProjectManager().getCurrentProject(); MZmineGUI.activateProject(currentProject); // Check for updated version NewVersionCheck NVC = new NewVersionCheck(CheckType.DESKTOP); Thread nvcThread = new Thread(NVC); nvcThread.setPriority(Thread.MIN_PRIORITY); nvcThread.start(); // Tracker GoogleAnalyticsTracker GAT = new GoogleAnalyticsTracker("MZmine Loaded (GUI mode)", "/JAVA/Main/GUI"); Thread gatThread = new Thread(GAT); gatThread.setPriority(Thread.MIN_PRIORITY); gatThread.start(); // register shutdown hook only if we have GUI - we don't want to // save configuration on exit if we only run a batch ShutDownHook shutDownHook = new ShutDownHook(); Runtime.getRuntime().addShutdownHook(shutDownHook); }
Example 18
Source File: Terciario.java From uip-pc2 with MIT License | 4 votes |
@FXML private void salir(ActionEvent actionEvent) { Platform.exit(); }
Example 19
Source File: MacMenuController.java From examples-javafx-repos1 with Apache License 2.0 | 4 votes |
@FXML public void close() { Platform.exit(); }
Example 20
Source File: DolphinPlatformApplication.java From dolphin-platform with Apache License 2.0 | 2 votes |
/** * This method is called if the connection to the Dolphin Platform server throws an exception at runtime. This can * for example happen if the server is shut down while the client is still running or if the server responses with * an error code. * * @param primaryStage the primary stage * @param runtimeException the exception */ protected void onRuntimeError(final Stage primaryStage, final DolphinRuntimeException runtimeException) { Assert.requireNonNull(runtimeException, "runtimeException"); LOG.error("Dolphin Platform runtime error in thread " + runtimeException.getThread().getName(), runtimeException); Platform.exit(); }