List of usage examples for javafx.stage Stage Stage
public Stage()
From source file:io.bitsquare.gui.main.overlays.Overlay.java
public void display() { if (owner == null) owner = MainView.getRootContainer(); if (owner != null) { Scene rootScene = owner.getScene(); if (rootScene != null) { Scene scene = new Scene(gridPane); scene.getStylesheets().setAll(rootScene.getStylesheets()); scene.setFill(Color.TRANSPARENT); setupKeyHandler(scene);/*from www.j a va2 s .com*/ stage = new Stage(); stage.setScene(scene); Window window = rootScene.getWindow(); setModality(); stage.initStyle(StageStyle.TRANSPARENT); stage.show(); layout(); addEffectToBackground(); // On Linux the owner stage does not move the child stage as it does on Mac // So we need to apply centerPopup. Further with fast movements the handler loses // the latest position, with a delay it fixes that. // Also on Mac sometimes the popups are positioned outside of the main app, so keep it for all OS positionListener = (observable, oldValue, newValue) -> { if (stage != null) { layout(); if (centerTime != null) centerTime.stop(); centerTime = UserThread.runAfter(this::layout, 3); } }; window.xProperty().addListener(positionListener); window.yProperty().addListener(positionListener); window.widthProperty().addListener(positionListener); animateDisplay(); } } }
From source file:org.beryx.viewreka.fxapp.ProjectLibs.java
public void installLibs(String prjName, File prjDir) { InstallLibsTask task = new InstallLibsTask(prjName, prjDir, lstLib); Stage progressStage = new Stage(); progressStage.setOnCloseRequest(ev -> { if (Dialogs.confirmYesNo("Cancel", "Are you sure you want to cancel the installation of project libraries?", null)) { task.cancel();/*from w w w . j a v a2s . c o m*/ } }); progressStage.initStyle(StageStyle.UTILITY); progressStage.initModality(Modality.APPLICATION_MODAL); progressStage.setTitle("Create project " + prjName); GridPane grid = new GridPane(); grid.setHgap(20); grid.setVgap(20); grid.setPadding(new Insets(24, 10, 0, 24)); ProgressIndicator progressIndicator = new ProgressIndicator(); progressIndicator.setPrefSize(64, 64); progressIndicator.setMinSize(64, 64); progressIndicator.setMaxSize(64, 64); // progressIndicator.progressProperty().bind(task.progressProperty()); grid.add(progressIndicator, 0, 0); Label actionLabel = new Label("Install project libraries..."); actionLabel.textProperty().bind(task.messageProperty()); grid.add(actionLabel, 1, 0); progressStage.setScene(new Scene(grid, 600, 120)); task.setOnSucceeded(ev -> closeProgress(progressStage, task)); task.setOnFailed(ev -> closeProgress(progressStage, task)); task.setOnCancelled(ev -> closeProgress(progressStage, task)); progressStage.setOnShown(ev -> Executors.newSingleThreadExecutor().submit(task)); progressStage.showAndWait(); }
From source file:ui.main.MainViewController.java
@FXML public void handleAboutMenuCall(ActionEvent event) { //this method displays the about try {/*from w ww. j ava 2 s . c om*/ //default configuration and initialization of the form Parent root = FXMLLoader.load(getClass().getClassLoader().getResource("ui/about/AboutView.fxml")); Scene scene = new Scene(root); Stage stage = new Stage(); stage.setScene(scene); stage.show(); stage.setResizable(false); stage.setTitle("About"); } catch (IOException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:org.ado.biblio.desktop.AppPresenter.java
public void returnBook() { LOGGER.info("returnBook"); Stage stage = new Stage(); final ReturnBookView returnBookView = new ReturnBookView(); final ReturnBookPresenter presenter = (ReturnBookPresenter) returnBookView.getPresenter(); presenter.init(stage, this, bookId); stage.initModality(Modality.APPLICATION_MODAL); stage.setScene(new Scene(returnBookView.getView())); stage.setTitle("Return Book"); stage.show();/* w w w .j a va2s .c o m*/ }
From source file:com.esri.geoevent.test.performance.ui.OrchestratorController.java
/** * Shows the report options dialog/*from w ww . ja v a 2s .c o m*/ */ private void showReportOptionsDialog() { try { // Load the fxml file and create a new stage for the popup FXMLLoader loader = new FXMLLoader(getClass().getResource("ReportOptions.fxml")); AnchorPane page = (AnchorPane) loader.load(); Stage dialogStage = new Stage(); dialogStage.setTitle(UIMessages.getMessage("UI_REPORT_OPTIONS_TITLE")); dialogStage.initModality(Modality.APPLICATION_MODAL); dialogStage.initOwner(stage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set the person into the controller ReportOptionsController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setReport(this.fixtures.getReport()); //TODO: we need to clone our Report Object Here // Show the dialog and wait until the user closes it dialogStage.showAndWait(); if (controller.isOkClicked()) { this.fixtures.setReport(controller.getReport()); } } catch (IOException e) { e.printStackTrace(); } }
From source file:net.sourceforge.pmd.util.fxdesigner.XPathPanelController.java
public void showExportXPathToRuleWizard() throws IOException { ExportXPathWizardController wizard = new ExportXPathWizardController(xpathExpressionProperty()); FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/xpath-export-wizard.fxml")); loader.setController(wizard);//from w w w . ja va2s . c o m final Stage dialog = new Stage(); dialog.initOwner(designerRoot.getMainStage()); dialog.setOnCloseRequest(e -> wizard.shutdown()); dialog.initModality(Modality.WINDOW_MODAL); Parent root = loader.load(); Scene scene = new Scene(root); //stage.setTitle("PMD Rule Designer (v " + PMD.VERSION + ')'); dialog.setScene(scene); dialog.show(); }
From source file:de.ks.text.AsciiDocEditor.java
@FXML void showPreviewPopup() { if (previewPopupStage == null) { String title = Localized.get("adoc.preview"); previewPopupStage = new Stage(); previewPopupStage.setTitle(title); Scene scene = new Scene(new StackPane(popupPreviewNode)); scene.setOnKeyReleased(e -> { if (e.getCode() == KeyCode.ESCAPE) { previewPopupStage.close(); }//from w w w.j av a 2 s . c o m }); previewPopupStage.setScene(scene); Rectangle2D bounds = new ScreenResolver().getScreenToShow().getBounds(); previewPopupStage.setX(bounds.getMinX()); previewPopupStage.setY(bounds.getMinY()); previewPopupStage.setWidth(bounds.getWidth()); previewPopupStage.setHeight(bounds.getHeight()); previewPopupStage.initModality(Modality.NONE); previewPopupStage.setOnShowing(e -> { popupPreview.showDirect(getText()); }); previewPopupStage.setOnCloseRequest(e -> this.previewPopupStage = null); previewPopupStage.show(); } }
From source file:com.danilafe.sbaccountmanager.StarboundServerAccountManager.java
private void createBannedIP(ListView<String> to_update) { Stage createBannedIP = new Stage(); createBannedIP.setTitle("Add Banned IP"); createBannedIP.initModality(Modality.APPLICATION_MODAL); GridPane gp = new GridPane(); gp.setPadding(new Insets(25, 25, 25, 25)); gp.setAlignment(Pos.CENTER);/*from w w w. j a v a 2 s .co m*/ gp.setVgap(10); gp.setHgap(10); Text title = new Text("Add Banned IP"); title.setFont(Font.font("Century Gothic", FontWeight.NORMAL, 20)); gp.add(title, 0, 0, 2, 1); Label newusername = new Label("Ban IP"); TextField username = new TextField(); gp.add(newusername, 0, 1); gp.add(username, 1, 1); Button finish = new Button("Finish"); HBox finish_box = new HBox(10); finish_box.setAlignment(Pos.CENTER); finish_box.getChildren().add(finish); finish.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { banned_ips.remove(username.getText()); banned_ips.add(username.getText()); to_update.setItems(FXCollections.observableArrayList(banned_ips)); createBannedIP.close(); } }); gp.add(finish_box, 0, 2, 2, 1); Scene sc = new Scene(gp, 300, 175); createBannedIP.setScene(sc); createBannedIP.show(); }
From source file:com.mycompany.pfinanzaspersonales.BuscadorController.java
@FXML private void btnBuscar(ActionEvent event) throws IOException { String desde_t = "", hasta_t = ""; if (input_desde.getValue() != null) { desde_t = input_desde.getValue().toString(); }/*from w ww . j a va 2 s. co m*/ if (input_hasta.getValue() != null) { hasta_t = input_hasta.getValue().toString(); } final String desde = desde_t; final String hasta = hasta_t; final Task<Void> tarea = new Task<Void>() { @Override protected Void call() throws Exception { HttpResponse response; List<NameValuePair> parametros = new ArrayList<NameValuePair>(); parametros.add(new BasicNameValuePair("tipo", cbb_tipo.getValue().toString())); parametros.add(new BasicNameValuePair("pago", cbb_pago.getValue().toString())); parametros.add(new BasicNameValuePair("desde", desde)); parametros.add(new BasicNameValuePair("hasta", hasta)); System.out.println(desde); response = JSON.request(Config.URL + "usuarios/buscar.json", parametros); JSONObject jObject = JSON.JSON(response); tabla_json = new ArrayList<TablaBuscar>(); try { editar.setCellValueFactory(new PropertyValueFactory<TablaBuscar, String>("editar")); eliminar.setCellValueFactory(new PropertyValueFactory<TablaBuscar, String>("eliminar")); fecha.setCellValueFactory(new PropertyValueFactory<TablaBuscar, String>("fecha")); categoria.setCellValueFactory(new PropertyValueFactory<TablaBuscar, String>("categoria")); tpago.setCellValueFactory(new PropertyValueFactory<TablaBuscar, String>("pago")); tmonto.setCellValueFactory(new PropertyValueFactory<TablaBuscar, String>("monto")); ttipo.setCellValueFactory(new PropertyValueFactory<TablaBuscar, String>("tipo")); tabla_json = new ArrayList<TablaBuscar>(); if (!jObject.get("data").equals(null)) { JSONArray jsonArr = jObject.getJSONArray("data"); for (int i = 0; i < jsonArr.length(); i++) { JSONObject data_json = jsonArr.getJSONObject(i); tabla_json.add(new TablaBuscar(data_json.get("idgastos").toString(), data_json.get("idgastos").toString(), data_json.get("idgastos").toString(), data_json.get("monto").toString(), data_json.get("fecha").toString(), data_json.get("nom_mediopago").toString(), data_json.get("categoria").toString(), data_json.get("tipo").toString())); } } tabla_buscador.setItems(FXCollections.observableArrayList(tabla_json)); } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void succeeded() { super.succeeded(); eliminar.setCellFactory(new Callback<TableColumn<String, String>, TableCell<String, String>>() { @Override public TableCell<String, String> call(TableColumn<String, String> p) { return new TableCell<String, String>() { @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (!isEmpty() && !empty) { final VBox vbox = new VBox(5); Image image = new Image(getClass().getResourceAsStream("/Imagenes/delete.png")); final Button boton = new Button("", new ImageView(image)); boton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Action response = Dialogs.create().title("Eliminar Gasto") .message("Ests seguro que desaeas eliminar el gasto?") .showConfirm(); if (response == Dialog.ACTION_YES) { TablaBuscar tabla = tabla_json.get(getTableRow().getIndex()); List<NameValuePair> parametros = new ArrayList<NameValuePair>(); String url = ""; if (tabla.getTipo() == "Gastos") { parametros .add(new BasicNameValuePair("idgastos", tabla.getId())); url = Config.URL + "gastos/eliminar.json"; } else { parametros.add( new BasicNameValuePair("idingresos", tabla.getId())); url = Config.URL + "ingresos/eliminar.json"; } HttpResponse responseJSON = JSON.request(url, parametros); JSONObject jObject = JSON.JSON(responseJSON); int code = Integer.parseInt(jObject.get("code").toString()); if (code == 201) { int selectdIndex = getTableRow().getIndex(); tabla_json.remove(selectdIndex); tabla_buscador.getItems().remove(selectdIndex); } else { Dialogs.create().title("Error sincronizacin").message( "Hubo un error al intentar eliminar . ERROR: 301") .showInformation(); } } } }); vbox.getChildren().add(boton); setGraphic(vbox); } else { setGraphic(null); } } }; } }); editar.setCellFactory(new Callback<TableColumn<String, String>, TableCell<String, String>>() { @Override public TableCell<String, String> call(TableColumn<String, String> p) { return new TableCell<String, String>() { @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (!isEmpty() && !empty) { final VBox vbox = new VBox(5); Image image = new Image(getClass().getResourceAsStream("/Imagenes/edit.png")); final Button boton = new Button("", new ImageView(image)); boton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { TablaBuscar tabla = tabla_json.get(getTableRow().getIndex()); Parent parent = null; if (tabla.getTipo() == "Gastos") { AgregarGastos AG = AgregarGastos.getInstance(); AG.setID(tabla.getId()); AG.setMonto(tabla.getMonto()); AG.setCategoria(tabla.getCategoria()); AG.setPago(tabla.getPago()); AG.setActualizacion(true); try { parent = FXMLLoader.load(this.getClass() .getResource("/fxml/AgregarGastos.fxml")); } catch (IOException ex) { Logger.getLogger(FXMLController.class.getName()) .log(Level.SEVERE, null, ex); } } else { AgregarIngresos AI = AgregarIngresos.getInstance(); AI.setID(tabla.getId()); AI.setMonto(tabla.getMonto()); AI.setCategoria(tabla.getCategoria()); AI.setPago(tabla.getPago()); AI.setActualizar(true); try { parent = FXMLLoader.load(this.getClass() .getResource("/fxml/AgregarIngresos.fxml")); } catch (IOException ex) { Logger.getLogger(FXMLController.class.getName()) .log(Level.SEVERE, null, ex); } } Stage stage = new Stage(); Scene scene = new Scene(parent); stage.setScene(scene); stage.show(); } }); vbox.getChildren().add(boton); setGraphic(vbox); } else { setGraphic(null); } } }; } }); } }; new Thread(tarea).start(); }
From source file:org.ado.biblio.desktop.AppPresenter.java
public void lend() throws SQLException { LOGGER.info("lend"); Stage stage = new Stage(); final LendView lendView = new LendView(); final LendPresenter presenter = (LendPresenter) lendView.getPresenter(); presenter.init(stage, this, bookId); stage.initModality(Modality.APPLICATION_MODAL); stage.setScene(new Scene(lendView.getView())); stage.setTitle("Lend Book"); stage.show();// w w w. j av a 2 s .co m }