Java Code Examples for javafx.stage.Stage#toFront()
The following examples show how to use
javafx.stage.Stage#toFront() .
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: ServiceWindow.java From ns-usbloader with GNU General Public License v3.0 | 6 votes |
/** Real window creator */ private static void getNotification(String title, String body, Alert.AlertType type){ Alert alertBox = new Alert(type); alertBox.setTitle(title); alertBox.setHeaderText(null); alertBox.setContentText(body); alertBox.getDialogPane().setMinWidth(Region.USE_PREF_SIZE); alertBox.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alertBox.setResizable(true); // Java bug workaround for JDR11/OpenJFX. TODO: nothing. really. alertBox.getDialogPane().getStylesheets().add(AppPreferences.getInstance().getTheme()); Stage dialogStage = (Stage) alertBox.getDialogPane().getScene().getWindow(); dialogStage.setAlwaysOnTop(true); dialogStage.getIcons().addAll( new Image("/res/warn_ico32x32.png"), new Image("/res/warn_ico48x48.png"), new Image("/res/warn_ico64x64.png"), new Image("/res/warn_ico128x128.png") ); alertBox.show(); dialogStage.toFront(); }
Example 2
Source File: FxmlStage.java From MyBox with Apache License 2.0 | 6 votes |
public static void alertWarning(Stage myStage, String information) { try { Alert alert = new Alert(Alert.AlertType.WARNING); alert.setTitle(myStage.getTitle()); alert.setHeaderText(null); alert.setContentText(information); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); alert.showAndWait(); } catch (Exception e) { logger.error(e.toString()); } }
Example 3
Source File: ImagesListController.java From MyBox with Apache License 2.0 | 6 votes |
public void saveFile(final File outFile) { if (outFile == null || tableController.tableData.isEmpty()) { return; } if (tableController.hasSampled()) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle(getMyStage().getTitle()); alert.setContentText(AppVariables.message("SureSampled")); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); ButtonType buttonSure = new ButtonType(AppVariables.message("Sure")); ButtonType buttonCancel = new ButtonType(AppVariables.message("Cancel")); alert.getButtonTypes().setAll(buttonSure, buttonCancel); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == buttonSure) { saveFileDo(outFile); } } else { saveFileDo(outFile); } }
Example 4
Source File: MyBoxLanguagesController.java From MyBox with Apache License 2.0 | 6 votes |
@FXML public void plusAction() { TextInputDialog dialog = new TextInputDialog(""); dialog.setTitle(message("ManageLanguages")); dialog.setHeaderText(message("InputLangaugeName")); dialog.setContentText(""); dialog.getEditor().setPrefWidth(200); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<String> result = dialog.showAndWait(); if (!result.isPresent() || result.get().trim().isBlank()) { return; } langName = result.get().trim(); langLabel.setText(langName); loadLanguage(null); }
Example 5
Source File: RTPlot.java From phoebus with Eclipse Public License 1.0 | 6 votes |
/** Show the configuration dialog or bring existing dialog to front */ public void showConfigurationDialog() { if (config_dialog == null) { config_dialog = new PlotConfigDialog<>(this); config_dialog.setOnHiding(evt -> config_dialog = null); DialogHelper.positionDialog(config_dialog, this, 30 - (int) getWidth()/2, 30 - (int) getHeight()/2); config_dialog.show(); } else { // Raise existing dialog final Stage stage = (Stage) config_dialog.getDialogPane().getContent().getScene().getWindow(); stage.toFront(); } }
Example 6
Source File: TableManageController.java From MyBox with Apache License 2.0 | 6 votes |
@FXML @Override public void clearAction() { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle(getBaseTitle()); alert.setContentText(AppVariables.message("SureClear")); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); ButtonType buttonSure = new ButtonType(AppVariables.message("Sure")); ButtonType buttonCancel = new ButtonType(AppVariables.message("Cancel")); alert.getButtonTypes().setAll(buttonSure, buttonCancel); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<ButtonType> result = alert.showAndWait(); if (result.get() != buttonSure) { return; } if (clearData()) { clearView(); refreshAction(); } }
Example 7
Source File: GameElimniationController.java From MyBox with Apache License 2.0 | 6 votes |
protected void promptDeadlock() { try { FxmlControl.BenWu2(); Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle(getBaseTitle()); alert.setContentText(AppVariables.message("NoValidElimination")); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); ButtonType buttonRenew = new ButtonType(AppVariables.message("RenewGame")); ButtonType buttonChance = new ButtonType(AppVariables.message("MakeChance")); alert.getButtonTypes().setAll(buttonRenew, buttonChance); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == buttonRenew) { newGame(false); popInformation(message("DeadlockDetectRenew")); } else if (result.get() == buttonChance) { makeChance(); popInformation(message("DeadlockDetectChance")); } } catch (Exception e) { logger.debug(e.toString()); } }
Example 8
Source File: HtmlEditorController.java From MyBox with Apache License 2.0 | 5 votes |
@Override public boolean checkBeforeNextAction() { // logger.debug(fileChanged.getValue()); if (fileChanged == null || !fileChanged.getValue()) { return true; } else { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle(getMyStage().getTitle()); alert.setContentText(AppVariables.message("FileChanged")); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); ButtonType buttonSave = new ButtonType(AppVariables.message("Save")); ButtonType buttonNotSave = new ButtonType(AppVariables.message("NotSave")); ButtonType buttonCancel = new ButtonType(AppVariables.message("Cancel")); alert.getButtonTypes().setAll(buttonSave, buttonNotSave, buttonCancel); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == buttonSave) { saveAction(); return true; } else { return result.get() == buttonNotSave; } } }
Example 9
Source File: MainMenu.java From Recaf with MIT License | 5 votes |
private SearchPane search(QueryType type, String key) { SearchPane pane = new SearchPane(controller, type); Stage stage = controller.windows().window( translate("ui.menubar.search") + ":" + translate("ui.menubar.search." + key), pane, 600, 400); stage.show(); stage.toFront(); return pane; }
Example 10
Source File: MyBoxLanguagesController.java From MyBox with Apache License 2.0 | 5 votes |
@FXML @Override public void deleteAction() { List<String> selected = listView.getSelectionModel().getSelectedItems(); if (selected == null || selected.isEmpty()) { return; } Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle(getMyStage().getTitle()); alert.setContentText(AppVariables.message("SureDelete")); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); ButtonType buttonSure = new ButtonType(AppVariables.message("Sure")); ButtonType buttonCancel = new ButtonType(AppVariables.message("Cancel")); alert.getButtonTypes().setAll(buttonSure, buttonCancel); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<ButtonType> result = alert.showAndWait(); if (result.get() != buttonSure) { return; } for (String name : selected) { File file = new File(AppVariables.MyBoxLanguagesPath + File.separator + name); file.delete(); } isSettingValues = true; listView.getItems().removeAll(selected); isSettingValues = false; langName = null; langLabel.setText(""); checkListSelected(); }
Example 11
Source File: MainMenu.java From Recaf with MIT License | 5 votes |
/** * Display history window. */ private void showHistory() { Stage stage = controller.windows().getHistoryWindow(); if(stage == null) { stage = controller.windows().window(translate("ui.menubar.history"), new HistoryPane(controller), 800, 600); controller.windows().setHistoryWindow(stage); } stage.show(); stage.toFront(); }
Example 12
Source File: WaitIndicator.java From mars-sim with GNU General Public License v3.0 | 5 votes |
public WaitIndicator(Stage stage) { this.stage = stage; //stage = new Stage(); indicator = new CircularProgressIndicator(); StackPane pane = new StackPane(indicator); //stackPane.setScaleX(1.2); //stackPane.setScaleY(1.2); pane.setBackground(Background.EMPTY); pane.setStyle( //"-fx-border-style: none; " //"-fx-background-color: #231d12; " "-fx-background-color: transparent; " + "-fx-background-radius: 1px;" ); Scene scene = new Scene(pane, 128, 128, true); scene.setFill(Color.TRANSPARENT); stage.requestFocus(); stage.initStyle(StageStyle.TRANSPARENT); stage.setTitle("Circular Progress Indicator"); stage.setScene(scene); stage.toFront(); stage.show(); indicator.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS); }
Example 13
Source File: MediaListController.java From MyBox with Apache License 2.0 | 5 votes |
@FXML @Override public void saveAsAction() { MediaList selected = tableView.getSelectionModel().getSelectedItem(); if (selected == null || selected.getMedias() == null) { return; } TextInputDialog dialog = new TextInputDialog(""); dialog.setTitle(message("ManageMediaLists")); dialog.setHeaderText(message("InputMediaListName")); dialog.setContentText(""); dialog.getEditor().setPrefWidth(400); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<String> result = dialog.showAndWait(); if (!result.isPresent() || result.get().trim().isBlank()) { return; } String newName = result.get().trim(); for (MediaList list : tableData) { if (list.getName().equals(newName)) { popError(message("AlreadyExisted")); return; } } if (TableMediaList.set(newName, selected.getMedias())) { popSuccessful(); tableData.add(MediaList.create().setName(newName).setMedias(selected.getMedias())); } else { popFailed(); } }
Example 14
Source File: ImageViewerController.java From MyBox with Apache License 2.0 | 5 votes |
public boolean deleteFile(File sfile) { if (sfile == null) { return false; } if (deleteConfirmCheck != null && deleteConfirmCheck.isSelected()) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle(getMyStage().getTitle()); alert.setContentText(AppVariables.message("SureDelete")); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); ButtonType buttonSure = new ButtonType(AppVariables.message("Sure")); ButtonType buttonCancel = new ButtonType(AppVariables.message("Cancel")); alert.getButtonTypes().setAll(buttonSure, buttonCancel); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<ButtonType> result = alert.showAndWait(); if (result.get() != buttonSure) { return false; } } if (sfile.delete()) { popSuccessful(); return true; } else { popFailed(); return false; } }
Example 15
Source File: ImageManufactureController.java From MyBox with Apache License 2.0 | 4 votes |
@FXML @Override public void saveAction() { if (!editable.get() || saveButton.isDisabled()) { return; } if (sourceFile == null) { saveAsAction(); return; } if (saveConfirmCheck.isSelected()) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle(getMyStage().getTitle()); alert.setContentText(AppVariables.message("SureOverrideFile")); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); ButtonType buttonSave = new ButtonType(AppVariables.message("Save")); ButtonType buttonSaveAs = new ButtonType(AppVariables.message("SaveAs")); ButtonType buttonCancel = new ButtonType(AppVariables.message("Cancel")); alert.getButtonTypes().setAll(buttonSave, buttonSaveAs, buttonCancel); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<ButtonType> result = alert.showAndWait(); if (result.get() == buttonCancel) { return; } else if (result.get() == buttonSaveAs) { saveAsAction(); return; } } synchronized (this) { if (task != null) { return; } task = new SingletonTask<Void>() { @Override protected boolean handle() { String format = "png"; if (imageInformation != null) { format = imageInformation.getImageFormat(); } final BufferedImage bufferedImage = FxmlImageManufacture.getBufferedImage(currentImageController.image); if (bufferedImage == null || task == null || isCancelled()) { return false; } ok = ImageFileWriters.writeImageFile(bufferedImage, format, sourceFile.getAbsolutePath()); if (!ok || task == null || isCancelled()) { return false; } ImageFileInformation finfo = ImageFileReaders.readImageFileMetaData(sourceFile.getAbsolutePath()); if (finfo == null || finfo.getImageInformation() == null) { return false; } imageInformation = finfo.getImageInformation(); return true; } @Override protected void whenSucceeded() { imageUpdated.set(false); updateBottom(ImageOperation.Saved); } }; openHandlingStage(task, Modality.WINDOW_MODAL); Thread thread = new Thread(task); thread.setDaemon(true); thread.start(); } }
Example 16
Source File: GameElimniationController.java From MyBox with Apache License 2.0 | 4 votes |
protected void makeChesses() { if (isSettingValues) { return; } catButton.setSelected(false); try { chessSize = Integer.parseInt(chessSizeSelector.getValue()); if (chessSize < 20) { chessSize = 20; } } catch (Exception e) { chessSize = 50; } AppVariables.setUserConfigValue("GameEliminationChessImageSize", chessSize + ""); AppVariables.setUserConfigValue("GameEliminationShadow", shadowCheck.isSelected()); AppVariables.setUserConfigValue("GameEliminationArc", arcCheck.isSelected()); selectedChesses.clear(); String s = ""; for (int i = 0; i < imagesListview.getItems().size(); ++i) { ImageItem item = imagesListview.getItems().get(i); item.setIndex(i); if (item.isSelected()) { selectedChesses.add(i); if (s.isBlank()) { s += item.getAddress() + ""; } else { s += "," + item.getAddress(); } } } if (selectedChesses.size() <= minimumAdjacent) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle(getBaseTitle()); alert.setContentText(MessageFormat.format(message("ChessesNumberTooSmall"), minimumAdjacent + "")); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); alert.showAndWait(); return; } AppVariables.setUserConfigValue("GameEliminationChessImages", s); boardSize = selectedChesses.size(); tabPane.getSelectionModel().select(playTab); makeChessBoard(); makeRulers(); newGame(true); }
Example 17
Source File: ConvolutionKernelManagerController.java From MyBox with Apache License 2.0 | 4 votes |
@FXML @Override public void clearAction() { if (tableData.isEmpty()) { return; } Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle(getMyStage().getTitle()); alert.setContentText(AppVariables.message("SureDelete")); alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); ButtonType buttonSure = new ButtonType(AppVariables.message("Sure")); ButtonType buttonCancel = new ButtonType(AppVariables.message("Cancel")); alert.getButtonTypes().setAll(buttonSure, buttonCancel); Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<ButtonType> result = alert.showAndWait(); if (result.get() != buttonSure) { return; } synchronized (this) { if (task != null) { return; } task = new SingletonTask<Void>() { @Override protected boolean handle() { new TableConvolutionKernel().clear(); new TableFloatMatrix().clear(); return true; } @Override protected void whenSucceeded() { loadList(); } }; openHandlingStage(task, Modality.WINDOW_MODAL); Thread thread = new Thread(task); thread.setDaemon(true); thread.start(); } }
Example 18
Source File: SecurityCertificatesAddController.java From MyBox with Apache License 2.0 | 4 votes |
@FXML @Override public void okAction() { if (certController == null) { return; } if (addressRadio.isSelected()) { if (addressInput.getText().isEmpty()) { popError(message("NotExist")); return; } } else { sourceFile = new File(sourceFileInput.getText()); if (!sourceFile.exists() || !sourceFile.isFile()) { popError(message("NotExist")); return; } } File ksFile = new File(certController.getSourceFileInput().getText()); if (!ksFile.exists() || !ksFile.isFile()) { popError(message("NotExist")); return; } String password = certController.getPasswordInput().getText(); TextInputDialog dialog = new TextInputDialog(""); dialog.setTitle(message("SecurityCertificates")); dialog.setHeaderText(message("Alias")); dialog.setContentText(""); dialog.getEditor().setPrefWidth(300); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<String> result = dialog.showAndWait(); if (!result.isPresent() || result.get().trim().isBlank()) { return; } final String alias = result.get().trim(); if (!certController.backupKeyStore()) { return; } try { synchronized (this) { if (task != null) { return; } task = new SingletonTask<Void>() { @Override protected boolean handle() { error = null; if (addressRadio.isSelected()) { try { error = NetworkTools.installCertificateByHost( ksFile.getAbsolutePath(), password, addressInput.getText(), alias); } catch (Exception e) { error = e.toString(); } } else if (fileRadio.isSelected()) { try { error = NetworkTools.installCertificateByFile( ksFile.getAbsolutePath(), password, sourceFile, alias); } catch (Exception e) { error = e.toString(); } } return true; } @Override protected void whenSucceeded() { if (error == null) { certController.loadAll(alias); if (saveCloseCheck.isSelected()) { closeStage(); } popSuccessful(); } else { popError(error); } } }; openHandlingStage(task, Modality.WINDOW_MODAL); Thread thread = new Thread(task); thread.setDaemon(true); thread.start(); } } catch (Exception e) { logger.error(e.toString()); } }
Example 19
Source File: SecurityCertificatesBypassController.java From MyBox with Apache License 2.0 | 4 votes |
@FXML @Override public void addAction() { try { TextInputDialog dialog = new TextInputDialog("docs.oracle.com"); dialog.setTitle(message("SSLVerificationByPass")); dialog.setHeaderText(message("InputAddress")); dialog.setContentText(""); dialog.getEditor().setPrefWidth(500); Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow(); stage.setAlwaysOnTop(true); stage.toFront(); Optional<String> result = dialog.showAndWait(); if (!result.isPresent()) { return; } String address = result.get().trim(); if (address.isBlank()) { return; } for (CertificateBypass p : tableData) { if (p.getHost().equals(address)) { return; } } if (TableBrowserBypassSSL.write(address)) { CertificateBypass newdata = TableBrowserBypassSSL.read(address); if (newdata != null) { tableData.add(newdata); tableView.refresh(); popSuccessful(); } else { popFailed(); } } else { popFailed(); } } catch (Exception e) { logger.error(e.toString()); } }
Example 20
Source File: DriversInstall.java From ns-usbloader with GNU General Public License v3.0 | 4 votes |
public DriversInstall(ResourceBundle rb){ if (DriversInstall.isRunning) return; DriversInstall.isRunning = true; DownloadDriversTask downloadTask = new DownloadDriversTask(); Button cancelButton = new Button(rb.getString("btn_Cancel")); HBox hBoxInformation = new HBox(); hBoxInformation.setAlignment(Pos.TOP_LEFT); hBoxInformation.getChildren().add(new Label(rb.getString("windowBodyDownloadDrivers"))); ProgressBar progressBar = new ProgressBar(); progressBar.setPrefWidth(Double.MAX_VALUE); progressBar.progressProperty().bind(downloadTask.progressProperty()); Label downloadStatusLabel = new Label(); downloadStatusLabel.setWrapText(true); downloadStatusLabel.textProperty().bind(downloadTask.messageProperty()); runInstallerStatusLabel = new Label(); runInstallerStatusLabel.setWrapText(true); Pane fillerPane1 = new Pane(); Pane fillerPane2 = new Pane(); VBox parentVBox = new VBox(); parentVBox.setAlignment(Pos.TOP_CENTER); parentVBox.setFillWidth(true); parentVBox.setSpacing(5.0); parentVBox.setPadding(new Insets(5.0)); parentVBox.setFillWidth(true); parentVBox.getChildren().addAll( hBoxInformation, fillerPane1, downloadStatusLabel, runInstallerStatusLabel, fillerPane2, progressBar, cancelButton ); // TODO:FIX VBox.setVgrow(fillerPane1, Priority.ALWAYS); VBox.setVgrow(fillerPane2, Priority.ALWAYS); Stage stage = new Stage(); stage.setTitle(rb.getString("windowTitleDownloadDrivers")); stage.getIcons().addAll( new Image("/res/dwnload_ico32x32.png"), //TODO: REDRAW new Image("/res/dwnload_ico48x48.png"), new Image("/res/dwnload_ico64x64.png"), new Image("/res/dwnload_ico128x128.png") ); stage.setMinWidth(400); stage.setMinHeight(150); Scene mainScene = new Scene(parentVBox, 405, 155); mainScene.getStylesheets().add(AppPreferences.getInstance().getTheme()); stage.setOnHidden(windowEvent -> { downloadTask.cancel(true ); DriversInstall.isRunning = false; }); stage.setScene(mainScene); stage.show(); stage.toFront(); downloadTask.setOnSucceeded(event -> { cancelButton.setText(rb.getString("btn_Close")); String returnedValue = downloadTask.getValue(); if (returnedValue == null) return; if (runInstaller(returnedValue)) stage.close(); }); Thread downloadThread = new Thread(downloadTask); downloadThread.start(); cancelButton.setOnAction(actionEvent -> { downloadTask.cancel(true ); stage.close(); }); }