List of usage examples for javafx.application Platform exit
public static void exit()
From source file:ubicrypt.ui.ctrl.MainController.java
public void exit(ActionEvent actionEvent) { Platform.exit(); }
From source file:ninja.eivind.hotsreplayuploader.Client.java
private void addToTray(final Stage primaryStage) { try {// w ww .ja va 2s . c om TrayIcon trayIcon = platformService.getTrayIcon(primaryStage); // update tooltip when the statusbinder changes status statusBinder.message().addListener((observable, oldValue, newValue) -> { if (newValue != null && !newValue.isEmpty()) { trayIcon.setToolTip("Status: " + newValue); } }); final SystemTray systemTray = SystemTray.getSystemTray(); systemTray.add(trayIcon); } catch (PlatformNotSupportedException | AWTException e) { LOG.warn("Could not instantiate tray icon. Reverting to default behaviour"); primaryStage.setOnCloseRequest(event -> Platform.exit()); } }
From source file:com.kotcrab.vis.editor.CrashReporter.java
private void sendReport() { progressBox.setVisible(true);/* ww w . j a v a 2s. co m*/ Task<Void> task = new Task<Void>() { @Override public Void call() { try { HttpURLConnection connection = (HttpURLConnection) new URL( REPORT_URL + "?filename=" + reportFile.getName()).openConnection(); connection.setDoOutput(true); connection.setRequestMethod("POST"); OutputStream os = connection.getOutputStream(); if (detailsTextArea.getText().equals("") == false) { os.write(("Details: " + detailsTextArea.getText()).getBytes()); os.write('\n'); } os.write(report.getBytes()); os.flush(); os.close(); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String s; while ((s = in.readLine()) != null) System.out.println("Server response: " + s); in.close(); System.out.println("Crash report sent"); } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void succeeded() { Platform.exit(); } @Override protected void failed() { Platform.exit(); } }; new Thread(task).start(); }
From source file:org.nmrfx.processor.gui.MainApp.java
public void quit() { waitForCommit(); Platform.exit(); System.exit(0); }
From source file:User.java
private HBox drawRow2() { PasswordField passwordField = new PasswordField(); passwordField.setFont(Font.font("SanSerif", 20)); passwordField.setPromptText("Password"); passwordField.setStyle(/*from ww w .j a v a 2s . c om*/ "-fx-text-fill:black; " + "-fx-prompt-text-fill:gray; " + "-fx-highlight-text-fill:black; " + "-fx-highlight-fill: gray; " + "-fx-background-color: rgba(255, 255, 255, .80); "); passwordField.prefWidthProperty().bind(primaryStage.widthProperty().subtract(55)); user.passwordProperty().bind(passwordField.textProperty()); // error icon SVGPath deniedIcon = new SVGPath(); deniedIcon.setFill(Color.rgb(255, 0, 0, .9)); deniedIcon.setStroke(Color.WHITE);// deniedIcon.setContent("M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 " + "16.447,13.08710.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10" + ".946,24.248 16.447,18.746 21.948,24.248z"); deniedIcon.setVisible(false); SVGPath grantedIcon = new SVGPath(); grantedIcon.setFill(Color.rgb(0, 255, 0, .9)); grantedIcon.setStroke(Color.WHITE);// grantedIcon.setContent( "M2.379,14.729 5.208,11.899 12.958,19.648 25.877," + "6.733 28.707,9.56112.958,25.308z"); grantedIcon.setVisible(false); // StackPane accessIndicator = new StackPane(); accessIndicator.getChildren().addAll(deniedIcon, grantedIcon); accessIndicator.setAlignment(Pos.CENTER_RIGHT); grantedIcon.visibleProperty().bind(GRANTED_ACCESS); // user hits the enter key passwordField.setOnAction(actionEvent -> { if (GRANTED_ACCESS.get()) { System.out.printf("User %s is granted access.\n", user.getUserName()); System.out.printf("User %s entered the password: %s\n", user.getUserName(), user.getPassword()); Platform.exit(); } else { deniedIcon.setVisible(true); } ATTEMPTS.set(ATTEMPTS.add(1).get()); System.out.println("Attempts: " + ATTEMPTS.get()); }); // listener when the user types into the password field passwordField.textProperty().addListener((obs, ov, nv) -> { boolean granted = passwordField.getText().equals(MY_PASS); GRANTED_ACCESS.set(granted); if (granted) { deniedIcon.setVisible(false); } }); // listener on number of attempts ATTEMPTS.addListener((obs, ov, nv) -> { if (MAX_ATTEMPTS == nv.intValue()) { // failed attempts System.out.printf("User %s is denied access.\n", user.getUserName()); Platform.exit(); } }); // second row HBox row2 = new HBox(3); row2.getChildren().addAll(passwordField, accessIndicator); return row2; }
From source file:de.perdoctus.ebikeconnect.gui.MainWindowController.java
public void exitApplication() { Platform.exit(); }
From source file:org.cryptomator.ui.MainApplication.java
private void quit() { Platform.runLater(() -> {// ww w . j a v a 2s .c om WebDavServer.getInstance().stop(); CLEAN_SHUTDOWN_PERFORMER.run(); Settings.save(); Platform.exit(); System.exit(0); }); }
From source file:de._692b8c32.cdlauncher.MainController.java
public void exit() { Platform.exit(); }
From source file:utilitybasedfx.MainGUIController.java
@FXML private void eventFileClose(ActionEvent event) { Platform.exit(); System.exit(0); }
From source file:ubicrypt.UbiCrypt.java
@Override public void start(final Stage stage) throws Exception { setUserAgentStylesheet(STYLESHEET_MODENA); stage.setTitle("UbiCrypt"); anchor().setStage(stage);/* w w w . ja v a2 s .co m*/ try { final PGPKeyPair kp = encryptionKey(); encrypt(Collections.singletonList(kp.getPublicKey()), new ByteArrayInputStream(StringUtils.repeat("ciao", 1).getBytes())); } catch (Exception e) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Strong Encryption Required"); alert.setHeaderText("Install JCE Unlimited Strength Jurisdiction policy files"); alert.setContentText( "You can install the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files, which are required to use strong encryption.\n" + "Download the files and instructions for Java 8.\n" + "Locate the jre\\lib\\security directory for the Java instance that the UbiCrypt is using.\n" + "For example, this location might be: C:\\Program Files\\Java\\jre8\\lib\\security.\n" + "Replace these two files with the .jar files included in the JCE Unlimited Strength Jurisdiction Policy Files download.\n" + "Stop and restart the UbiCrypt.\n\n\n\n\n\n"); ButtonType icePage = new ButtonType("Go to JCE download Page"); alert.getButtonTypes().addAll(icePage); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == icePage) { getHostServices().showDocument( "http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html"); } Platform.exit(); } final File secFile = securityFile().toFile(); stage.setScene(anchor().show(secFile.exists() ? "login" : "createKey", getHostServices())); stage.show(); final UbiCrypt ubiCrypt = this; anchor().getPasswordStream().subscribeOn(Schedulers.io()).subscribe(pwd -> { final SpringApplication app = new SpringApplication(UbiConf.class, PathConf.class, UIConf.class); app.setRegisterShutdownHook(false); app.addInitializers(new FixPassPhraseInitializer(pwd)); app.setLogStartupInfo(true); ctx = app.run(); ctx.getAutowireCapableBeanFactory().autowireBean(ubiCrypt); ctx.getBeanFactory().registerSingleton("stage", stage); ctx.getBeanFactory().registerSingleton("hostService", getHostServices()); ctx.getBeanFactory().registerSingleton("osUtil", new OSUtil(getHostServices())); ControllerFactory cfactory = new ControllerFactory(ctx); StackNavigator navigator = new StackNavigator(null, "main", cfactory); stage.setScene(new Scene(navigator.open())); }); stage.setOnCloseRequest(windowEvent -> shutdown.run()); Runtime.getRuntime().addShutdownHook(new Thread(shutdown)); }