List of usage examples for javafx.application Platform exit
public static void exit()
From source file:Main.java
@Override public void start(final Stage primaryStage) { primaryStage.setTitle("title"); Group root = new Group(); Scene scene = new Scene(root, 400, 300, Color.WHITE); MenuBar menuBar = new MenuBar(); menuBar.prefWidthProperty().bind(primaryStage.widthProperty()); Menu menu = new Menu("File"); MenuItem exitItem = new MenuItem("Exit", null); exitItem.setMnemonicParsing(true);//from w ww .j a v a 2 s. c o m exitItem.setAccelerator(new KeyCodeCombination(KeyCode.X, KeyCombination.CONTROL_DOWN)); exitItem.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { Platform.exit(); } }); menu.getItems().add(exitItem); menuBar.getMenus().add(menu); root.getChildren().add(menuBar); primaryStage.setScene(scene); primaryStage.show(); }
From source file:com.loyalty.LoyalityPointManagement.java
@Override public void stop() throws Exception { if (context != null && context.isActive()) { context.close();//from ww w . java 2s . c o m } Platform.exit(); }
From source file:UIController.java
@FXML public void closeButton() { Platform.exit(); }
From source file:Main.java
License:asdf
@Override public void start(Stage primaryStage) { User user = new User(); Group root = new Group(); Scene scene = new Scene(root, 320, 100); primaryStage.setScene(scene);//from ww w . j av a 2 s . c o m Text userName = new Text(); userName.textProperty().bind(user.userNameProperty()); PasswordField passwordField = new PasswordField(); passwordField.setPromptText("Password"); user.passwordProperty().bind(passwordField.textProperty()); // user hits the enter key passwordField.setOnAction(actionEvent -> { if (accessGranted.get()) { System.out.println("granted access:" + user.getUserName()); System.out.println("password:" + user.getPassword()); Platform.exit(); } else { primaryStage.setTitle("no access"); } }); passwordField.textProperty().addListener((obs, ov, nv) -> { boolean granted = passwordField.getText().equals(MY_PASS); accessGranted.set(granted); if (granted) { primaryStage.setTitle(""); } }); VBox formLayout = new VBox(4); formLayout.getChildren().addAll(userName, passwordField); formLayout.setLayoutX(12); formLayout.setLayoutY(12); root.getChildren().addAll(formLayout); primaryStage.show(); }
From source file:com.adobe.ags.curly.test.ErrorBehaviorTest.java
@AfterClass public static void tearDownClass() { ConnectionManager.getInstance().shutdown(); if (webserver != null) { webserver.shutdown();// w w w . j ava 2s. co m } Platform.exit(); }
From source file:com.toyota.carservice.controller.SplashController.java
/** * Initializes the controller class.//from w ww. j a v a 2 s . c o m * @param url * @param rb */ @Override public void initialize(URL url, ResourceBundle rb) { longStart(); lblClose.setOnMouseClicked((MouseEvent event) -> { Platform.exit(); System.exit(0); }); // TODO }
From source file:com.bekwam.mavenpomupdater.MenuBarDelegate.java
public void close() { if (log.isDebugEnabled()) { log.debug("[CLOSE]"); } Platform.exit(); }
From source file:com.loyalty.LoyalityPointManagement.java
private void login(Stage stage) { HttpClient client = context.getBean("httpClient", HttpClient.class); try {/* ww w .j a v a 2 s . c om*/ client.login(); } catch (IOException | HttpException e) { dialogManager().showInformation("No Connection with server"); Platform.exit(); System.exit(-1); } }
From source file:com.esri.geoevent.test.performance.ui.ProducerUI.java
@Override public void start(Stage primaryStage) { String modeStr = "Producer"; if (StringUtils.isEmpty(modeStr)) { System.err.print(UIMessages.getMessage("STARTUP_ERROR_MODE_NULL") + UIMessages.getMessage("STARTUP_MODE_TYPES", Mode.getAllowableValues())); Platform.exit(); System.exit(0);//from w ww . j a v a 2 s . co m return; } Mode mode = Mode.fromValue(modeStr); String fxmlFile = ""; Object controller = null; switch (mode) { case Producer: fxmlFile = "PerformanceCollector.fxml"; controller = new ProducerController(); break; default: System.err.print(UIMessages.getMessage("STARTUP_ERROR_MODE_UNKNOWN", mode) + UIMessages.getMessage("STARTUP_MODE_TYPES", Mode.getAllowableValues())); Platform.exit(); System.exit(0); return; } Platform.setImplicitExit(true); try { FXMLLoader loader = new FXMLLoader(getClass().getResource(fxmlFile)); if (controller != null) { loader.setController(controller); } Parent parent = (Parent) loader.load(); Scene scene = new Scene(parent); primaryStage.setOnCloseRequest(new AppCloser()); primaryStage.setTitle(UIMessages.getMessage("UI_TITLE", mode)); primaryStage.setScene(scene); primaryStage.show(); ProducerUI.primaryStage = primaryStage; } catch (IOException e) { e.printStackTrace(); } }
From source file:com.esri.geoevent.test.performance.ui.ConsumerUI.java
@Override public void start(Stage primaryStage) { String modeStr = "Consumer"; if (StringUtils.isEmpty(modeStr)) { System.err.print(UIMessages.getMessage("STARTUP_ERROR_MODE_NULL") + UIMessages.getMessage("STARTUP_MODE_TYPES", Mode.getAllowableValues())); Platform.exit(); System.exit(0);/* w ww .j av a 2s. c om*/ return; } Mode mode = Mode.fromValue(modeStr); String fxmlFile = ""; Object controller = null; switch (mode) { case Consumer: fxmlFile = "PerformanceCollector.fxml"; controller = new ConsumerController(); break; default: System.err.print(UIMessages.getMessage("STARTUP_ERROR_MODE_UNKNOWN", mode) + UIMessages.getMessage("STARTUP_MODE_TYPES", Mode.getAllowableValues())); Platform.exit(); System.exit(0); return; } Platform.setImplicitExit(true); try { FXMLLoader loader = new FXMLLoader(getClass().getResource(fxmlFile)); if (controller != null) { loader.setController(controller); } Parent parent = (Parent) loader.load(); Scene scene = new Scene(parent); primaryStage.setOnCloseRequest(new AppCloser()); primaryStage.setTitle(UIMessages.getMessage("UI_TITLE", mode)); primaryStage.setScene(scene); primaryStage.show(); ConsumerUI.primaryStage = primaryStage; } catch (IOException e) { e.printStackTrace(); } }