@FXML private javafx.scene.control.Button closeButton; @FXML private void closeButtonAction(){ // get a handle to the stage Stage stage = (Stage) closeButton.getScene().getWindow(); // do what you have to do stage.close(); }
@Override public void quit() { stage.close(); }
private void close() { dialog.setScene(null); dialog.close(); }
private void closeWindow() { issueComponent.clear(); final Stage stage = (Stage) btnClose.getScene().getWindow(); stage.close(); } }
public static EventHandler<ActionEvent> newCloseHandler() { return event -> { final Node source = (Node) event.getSource(); final Stage stage = (Stage) source.getScene().getWindow(); stage.close(); }; }
@FXML public void handleCloseButtonAction(ActionEvent event) { Stage stage = (Stage) closeButton.getScene().getWindow(); stage.close(); }
@Override public void initialize(URL location, ResourceBundle resources) { commitButton.setOnAction(e -> { commitHandler.ifPresent(Runnable::run); getStage().close(); this.free(); }); commitButton.disableProperty().bind(validationSupport.invalidProperty()); Platform.runLater(() -> { typeId.bind(typeChoiceBox.getSelectionModel().selectedItemProperty()); typeChoiceBox.setConverter(DesignerUtil.stringConverter(PropertyTypeId::getStringId, PropertyTypeId::lookupMnemonic)); typeChoiceBox.getItems().addAll(PropertyTypeId.typeIdsToConstants().values()); FXCollections.sort(typeChoiceBox.getItems()); }); Platform.runLater(this::registerBasicValidators); typeIdProperty().values() .filter(Objects::nonNull) .subscribe(this::registerTypeDependentValidators); }
popup.close(); });
new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { // take some action ... // close the dialog. Node source = (Node) actionEvent.getSource(); Stage stage = (Stage) source.getScene().getWindow(); stage.close(); } }
@FXML private void CloseAction(ActionEvent event) { Stage stage = (Stage) Close.getScene().getWindow(); stage.close(); }
public class Controller { public void onMouseClickAction(ActionEvent e) { Stage s = Main.getPrimaryStage(); s.close(); } }
@Override public void close() { this.w.close(); } }
/** * */ @FXML protected void clickCancel() { this.dialogStage.close(); }
void removeItem() { AppThread.exec(() -> { synchronized (lock) { items.get(current).stage.get().close(); itemMap.remove(items.remove(current).itemId.get()); current = 0; return null; } }); }
/** * Exits the SportsTracker application and releases the resources before. */ private void exitApplication() { context.getPrimaryStage().close(); }
scene.addEventHandler(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent> () { @Override public void handle(KeyEvent t) { if(t.getCode()==KeyCode.ESCAPE) { System.out.println("click on escape"); Stage sb = (Stage)label.getScene().getWindow();//use any one object sb.close(); } } });
/** * {@inheritDoc} */ @Override public void close() { AppThread.exec(statusCode, () -> { stage.get().close(); return null; }); }
/** * {@inheritDoc} */ @Override public void doDestroyStage(final Wave wave) { final String stageKey = getWaveBean(wave).stageKey(); Platform.runLater(() -> this.stageMap.get(stageKey).close()); this.stageMap.remove(stageKey); }
public class test1 extends Application{ public static String fileAsString; @Override public void start(Stage primaryStage) throws Exception { FileChooser fileChooser = new FileChooser(); File file = fileChooser.showOpenDialog(primaryStage); fileAsString = file.getAbsolutePath(); primaryStage.setOpacity(0); primaryStage.show(); primaryStage.close(); } }