@FXML private void handleAddNewDrug(ActionEvent event) throws IOException { FXMLLoader fXMLLoader = new FXMLLoader(); fXMLLoader.setLocation(getClass().getResource("/view/drug/NewDrug.fxml")); Stage stage = new Stage(); Scene scene = new Scene(fXMLLoader.load()); stage.setScene(scene); stage.initModality(Modality.APPLICATION_MODAL); stage.setTitle("New Drug"); stage.show(); stage.setOnCloseRequest((WindowEvent event1) -> { drugs.clear(); loadDrug(); }); }
public AlertBox(Stage primaryStage, FXMLLoader fxmlLoader, boolean alertType, String msg) { try { Parent root = (Parent) fxmlLoader.load(); Scene scene = new Scene(root); Label alertText = (Label) scene.lookup("#alert_text"); alertText.setText(msg); if (alertType == true) alertText.setStyle("-fx-text-fill: chartreuse"); else alertText.setStyle("-fx-text-fill: red"); Stage stage = new Stage(); stage.setResizable(false); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(primaryStage); stage.initStyle(StageStyle.UNDECORATED); stage.setScene(scene); stage.showAndWait(); } catch (Exception e) { } }
public static void showAndWait(String url, Predicate<WebEngine> loginSuccessTest, Consumer<WebEngine> handler) { try { FXMLLoader loader = new FXMLLoader(LoginController.class.getResource("/fxml/login.fxml")); Stage stage = new Stage(); stage.setScene(new Scene(loader.load())); LoginController controller = loader.<LoginController>getController(); controller.setUrl(url); controller.setLoginSuccessTest(loginSuccessTest); controller.setHandler(handler); stage.setTitle("Login..."); stage.initModality(Modality.APPLICATION_MODAL); stage.showAndWait(); } catch (IOException ex) { throw new RuntimeException(ex); } }
/** * Displays the StudyProfile details page * * @param profile StudyProfile for which the details should be shown. */ public void studyProfileDetails(StudyProfile profile) throws IOException { StudyProfileController spc = new StudyProfileController(profile); // Load in the .fxml file: FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/StudyProfile.fxml")); loader.setController(spc); Parent root = loader.load(); // Set the scene: Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setScene(new Scene(root, 550, 232)); stage.setTitle(profile.getName()); stage.resizableProperty().setValue(false); stage.getIcons().add(new Image("file:icon.png")); stage.showAndWait(); }
protected void addTransition (String typeName) { System.out.println("add transition: " + typeName); //get fxml path String fxmlPath = Transition.getTransitionByType(typeName).getFXMLPath(); FXMLWindow dialog = null; try { dialog = new FXMLWindow("Add Transition", 440, 240, fxmlPath, Transition.getTransitionByType(typeName).createFXMLController(this, entry, index)); } catch (Exception e) { JavaFXUtils.showExceptionDialog("Exception", "Cannot add transition, exception was thrown. Please copy this stacktrace and send it to developers!", e); return; } Stage stage = dialog.getStage(); stage.hide(); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(this.stage); stage.showAndWait(); refreshListView(); }
/** * Creates a new JavaFX stage for adding/editing/deleting a {@link DatabaseItem} * * @param viewPath the path to the xml file representing the view * @param stageTitle the title to be shown at the top of the stage */ private void createDatabaseItemModificationStage(String viewPath, String stageTitle) { try { FXMLLoader loader = new FXMLLoader(getClass().getResource(viewPath)); Stage newStage = new Stage(); newStage.setTitle(stageTitle); newStage.setScene(new Scene(loader.load())); DatabaseItemModificationController databaseItemModificationController = loader.getController(); databaseItemModificationController.setNewLogEntryTabController(this); databaseItemModificationController.setStage(newStage); newStage.initModality(Modality.APPLICATION_MODAL); newStage.show(); } catch (IOException e) { createErrorStage(); e.printStackTrace(); } }
public static Stage getStage(Window owner) { Stage stage = new Stage(); ResourceBundle resources = ResourceBundle.getBundle("fxml/i18n/klc"); URL location = ExternalMonitor.class.getResource("/fxml/ExternalMonitor.fxml"); FXMLLoader loader = new FXMLLoader(location, resources); try { loader.load(); } catch (IOException e) { throw new RuntimeException(e); } stage.setTitle("Server Monitor"); stage.initModality(Modality.NONE); stage.initStyle(StageStyle.UTILITY); stage.initOwner(owner); stage.setScene(new Scene(loader.getRoot())); return stage; }
@FXML private void onEditPriceClickedButton() throws IOException { Stage editPriceDialogStage = new Stage(); Parent editPriceDialogRoot = FXMLLoader.load( getClass().getResource("/fxml/EditPriceDialog.fxml") ); service = roomTableView.getSelectionModel().getSelectedItem(); Scene editPriceDialog = new Scene(editPriceDialogRoot); editPriceDialogStage.getIcons().add(new Image("images/Logo.png")); editPriceDialogStage.setScene(editPriceDialog); editPriceDialogStage.initModality(Modality.APPLICATION_MODAL); editPriceDialogStage.initOwner(editPriceButton.getScene().getWindow()); editPriceDialogStage.setResizable(false); editPriceDialogStage.setTitle("Edit Price"); editPriceDialogStage.centerOnScreen(); editPriceDialogStage.show(); }
@FXML public void showNoticeDialog() { try { FXMLLoader loader = new FXMLLoader(Main.class.getResource("views/Notice.fxml")); StackPane page = (StackPane) loader.load(); Stage dialog = new Stage(); Scene scene = new Scene(page); dialog.getIcons().add(new Image("file:wdm.png")); dialog.setTitle("공지사항"); dialog.initModality(Modality.WINDOW_MODAL); dialog.setResizable(false); dialog.setScene(scene); dialog.setAlwaysOnTop(true); dialog.show(); } catch (Exception e) { e.printStackTrace(); } }
public static void alwaysInTop(Alert alert) { try{ DialogPane root = alert.getDialogPane(); Stage dialogStage = new Stage(StageStyle.UTILITY); for (ButtonType buttonType : root.getButtonTypes()) { ButtonBase button = (ButtonBase) root.lookupButton(buttonType); button.setOnAction(evt -> { root.setUserData(buttonType); dialogStage.close(); }); } root.getScene().setRoot(new Group()); Scene scene = new Scene(root); dialogStage.setScene(scene); dialogStage.initModality(Modality.APPLICATION_MODAL); dialogStage.setAlwaysOnTop(true); dialogStage.setResizable(false); dialogStage.showAndWait(); }catch(Exception e){ } // Optional<ButtonType> result = Optional.ofNullable((ButtonType) root.getUserData()); }
public static void showPackageDiff(PackageType left, PackageType right, AuthHandler handler) { try { FXMLLoader loader = new FXMLLoader(EpicApp.class.getResource("/fxml/PackageCompare.fxml")); loader.setResources(ApplicationState.getInstance().getResourceBundle()); loader.load(); PackageCompareController runnerActivityController = loader.getController(); Stage popup = new Stage(); popup.setTitle("Package Comparison"); popup.setScene(new Scene(loader.getRoot())); popup.initModality(Modality.NONE); popup.initOwner(applicationWindow); runnerActivityController.initDiffView(left, right, handler); popup.showAndWait(); } catch (IOException ex) { Logger.getLogger(EpicApp.class.getName()).log(Level.SEVERE, null, ex); } }
private void editDrug(Drug drug) { FXMLLoader fXMLLoader = new FXMLLoader(getClass().getResource("/view/drug/EditDrug.fxml")); try { Parent root = fXMLLoader.load(); EditDrugController controller = fXMLLoader.getController(); controller.setDrugId(drug.getId()); controller.taNote.setText(drug.getNote()); controller.tfTradeName.setText(drug.getName()); controller.tfGenericName.setText(drug.getGenricName()); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setTitle("Edit Drug"); stage.setScene(new Scene(root)); stage.show(); } catch (IOException ex) { Logger.getLogger(PatientsController.class.getName()).log(Level.SEVERE, null, ex); } }
public void start() { stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setTitle("Rename File"); stage.setWidth(400); stage.setHeight(150); stage.setResizable(false); Screen screen = new Screen(); Point point = screen.calculateCenter(400, 150); stage.setX(point.getX()); stage.setY(point.getY()); CustomIcons customIcons = new CustomIcons(); stage.getIcons().add(customIcons.getLogo()); RenameFolderView renameFolderView = new RenameFolderView(); Scene scene = new Scene(renameFolderView.getView()); stage.setScene(scene); stage.show(); }
/** * Displays the reset password dialog for the currently selected employee. * * @throws IOException */ @FXML private void onResetEmployeePasswordButtonClicked() throws IOException { Stage dialogStage = new Stage(); FXMLLoader loader = new FXMLLoader( getClass().getResource("/fxml/ResetEmployeePasswordDialog.fxml") ); Parent dialogRoot = loader.load(); Scene resetPasswordDialog = new Scene(dialogRoot); dialogStage.getIcons().add(new Image("images/Logo.png")); dialogStage.setScene(resetPasswordDialog); dialogStage.initModality(Modality.APPLICATION_MODAL); dialogStage.initOwner(resetEmployeePasswordButton.getScene().getWindow()); dialogStage.setResizable(false); dialogStage.setTitle("Confirm"); dialogStage.centerOnScreen(); ResetEmployeePasswordDialogController c; c = (ResetEmployeePasswordDialogController) loader.getController(); long employeeId = getSelectedEmployee().getId(); c.setEmployeeId(employeeId); dialogStage.show(); }
public void start() { stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setTitle("Create Folder"); stage.setWidth(400); stage.setHeight(150); stage.setResizable(false); Screen screen = new Screen(); Point point = screen.calculateCenter(400, 150); stage.setX(point.getX()); stage.setY(point.getY()); CustomIcons customIcons = new CustomIcons(); stage.getIcons().add(customIcons.getLogo()); CreateFolderView createFolderView = new CreateFolderView(); Scene scene = new Scene(createFolderView.getView()); stage.setScene(scene); stage.show(); }
public void start() { stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setTitle("Create File"); stage.setWidth(400); stage.setHeight(150); stage.setResizable(false); Screen screen = new Screen(); Point point = screen.calculateCenter(400, 150); stage.setX(point.getX()); stage.setY(point.getY()); CustomIcons customIcons = new CustomIcons(); stage.getIcons().add(customIcons.getLogo()); CreateFileView createFileView = new CreateFileView(); Scene scene = new Scene(createFileView.getView()); stage.setScene(scene); stage.show(); }
/** * Displays the pop-up dialog which prompts staff members to log in to the system. * * @throws IOException */ @FXML public void onStaffModeButtonClicked() throws IOException { Stage staffLoginDialogStage = new Stage(); Parent staffLoginDialogRoot = FXMLLoader.load( getClass().getResource("/fxml/StaffLoginDialog.fxml") ); Scene staffLoginDialog = new Scene(staffLoginDialogRoot); staffLoginDialogStage.getIcons().add(new Image("images/Logo.png")); staffLoginDialogStage.setScene(staffLoginDialog); staffLoginDialogStage.initModality(Modality.APPLICATION_MODAL); staffLoginDialogStage.initOwner(staffModeButton.getScene().getWindow()); staffLoginDialogStage.setResizable(false); staffLoginDialogStage.setTitle("Authentication Required"); staffLoginDialogStage.centerOnScreen(); staffLoginDialogStage.show(); }
public static void display(String title, String message) { Stage window = new Stage(); window.initModality(Modality.APPLICATION_MODAL); window.setTitle(title); window.setMinWidth(250); Label label = new Label(); label.setText(message); Button closeButton = new Button("Close the window"); closeButton.setOnAction(e -> window.close()); VBox layout = new VBox(10); layout.getChildren().addAll(label, closeButton); layout.setAlignment(Pos.CENTER); Scene scene = new Scene(layout); window.setScene(scene); window.setResizable(false); window.showAndWait(); }
@FXML private void clickItem(MouseEvent event) throws IOException { if (event.getClickCount() == 2) { stage = (Stage) label.getScene().getWindow(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/callib/Views/SearchDetails.fxml")); Stage modal = new Stage(); modal.initModality(Modality.APPLICATION_MODAL); modal.setScene( new Scene((Pane) loader.load()) ); modal.setX(stage.getX() + 50); modal.setY(stage.getY() + 50); SearchDetailsController controller = (SearchDetailsController) loader.getController(); controller.initData(table.getSelectionModel().getSelectedItem().getId()); modal.showAndWait(); this.displayData(); } }
/** * Creates error stage with a custom message * * @param customErrorMessage the error message to be shown to the user */ private void createErrorStage(String customErrorMessage) { try { FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/error.fxml")); Stage errorStage = new Stage(); errorStage.setTitle("Error"); errorStage.setScene(new Scene(loader.load())); ErrorController errorController = loader.getController(); errorController.setCustomErrorMessage(customErrorMessage); errorController.setStage(errorStage); errorStage.initModality(Modality.APPLICATION_MODAL); errorStage.show(); } catch (IOException e) { e.printStackTrace(); } }
public GithubRepoDialogController showGithubRepoDialog(){ GithubRepoDialogController controller = null; try { FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource("com/kaanburaksener/octoUML/src/view/fxml/githubRepoDialog.fxml")); AnchorPane page = loader.load(); Stage dialogStage = new Stage(); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(this.stage); dialogStage.setScene(new Scene(page)); controller = loader.getController(); controller.setDialogStage(dialogStage); dialogStage.showAndWait(); } catch (IOException e){ e.printStackTrace(); } return controller; }
/** * Create instance of {@link ProgressBarView}. */ public ProgressBarView() { try { final Stage newStage = new Stage(); newStage.setResizable(false); final URL resource = getClass().getResource(PROGRESS_BAR_VIEW); fxmlLoader = new FXMLLoader(resource); final Stage primaryStage = Hygene.getInstance().getPrimaryStage(); newStage.initOwner(primaryStage); newStage.initStyle(StageStyle.UTILITY); newStage.initModality(Modality.APPLICATION_MODAL); final double centerXPosition = primaryStage.getX() + primaryStage.getWidth() / 2; final double centerYPosition = primaryStage.getY() + primaryStage.getHeight() / 2; newStage.setOnShowing(event -> newStage.hide()); newStage.setOnShown(event -> { newStage.setX(centerXPosition - newStage.getWidth() / 2); newStage.setY(centerYPosition - newStage.getHeight() / 2); newStage.show(); }); setStage(newStage); } catch (final UIInitialisationException e) { LOGGER.error("Progress bar view could not be loaded.", e); } }
/** * Create a new instance of a {@link SettingsView}. * * @param settings {@link Settings} of the application * @param fxmlLoader a {@link FXMLLoader} instance for instantiating the new window */ @Inject public SettingsView(final Settings settings, final FXMLLoader fxmlLoader) { try { final Stage newStage = new Stage(); newStage.setResizable(false); newStage.setTitle(TITLE); final URL resource = getClass().getResource(SETTINGS_VIEW); fxmlLoader.setLocation(resource); final Parent parent = fxmlLoader.load(); if (parent == null) { throw new UIInitialisationException("Root of Settings could not be found."); } final Stage primaryStage = Hygene.getInstance().getPrimaryStage(); newStage.initModality(Modality.WINDOW_MODAL); newStage.initOwner(primaryStage); newStage.setScene(new Scene(parent)); // TODO show prompt box asking the user if they want to close if they have unsaved settings. newStage.setOnCloseRequest(request -> settings.clearAll()); setStage(newStage); } catch (final IOException | UIInitialisationException e) { LOGGER.error("Unable to initialize SettingsView.", e); } }
/** * Creates an instance of a {@link GenomeMappingView}. * * @throws IOException if unable to load the controller */ @Inject public GenomeMappingView(final FXMLLoader fxmlLoader) throws UIInitialisationException, IOException { stage = new Stage(); stage.setTitle(TITLE); stage.initModality(Modality.APPLICATION_MODAL); stage.setOnCloseRequest(Event::consume); // prevent user from closing stage directly final URL resource = getClass().getResource(GENOME_MAPPING_VIEW); fxmlLoader.setLocation(resource); final Scene rootScene = new Scene(fxmlLoader.load()); stage.setScene(rootScene); }
@FXML private void clickItem(MouseEvent event) throws IOException { if (event.getClickCount() == 2) { stage = (Stage) label.getScene().getWindow(); FXMLLoader loader = new FXMLLoader(getClass().getResource("/callib/Views/RequestedDetails.fxml")); Stage modal = new Stage(); modal.initModality(Modality.APPLICATION_MODAL); modal.setScene( new Scene((Pane) loader.load()) ); modal.setX(stage.getX() + 50); modal.setY(stage.getY() + 50); RequestedDetailsController controller = (RequestedDetailsController) loader.getController(); controller.initData(table.getSelectionModel().getSelectedItem().getId()); modal.showAndWait(); this.displayData(); } }
@FXML public void openDownloader(ActionEvent actionEvent) throws IOException { Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.initOwner(this.tableView.getScene().getWindow()); Parent root = FXMLLoader.load(getClass().getResource("/Downloader.fxml")); root.getStylesheets().add(this.getClass().getResource(Main.properties.getProperty("css")).toExternalForm()); javafx.scene.Scene scene = new javafx.scene.Scene(root); stage.setScene(scene); stage.setTitle("鳳凰卓牌譜ダウンロード"); stage.show(); stage.setOnHiding(event -> { this.tableView.getItems().clear(); this.tableView.getItems().addAll(this.databaseService.findAllExistsInfos()); }); }
private void loadPrintablePrescription(int prescriptionId, boolean stageClose) { FXMLLoader fXMLLoader = new FXMLLoader(getClass().getResource("/view/prescription/ViewPrescription.fxml")); try { Parent root = fXMLLoader.load(); ViewPrescriptionController controller = fXMLLoader.getController(); controller.loadPrescription(prescriptionId); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setTitle("Print Prescription"); stage.setScene(new Scene(root)); stage.show(); if (stageClose) { Stage nStage = (Stage) lblAge.getScene().getWindow(); nStage.close(); } } catch (IOException ex) { Logger.getLogger(PrescriptionsController.class.getName()).log(Level.SEVERE, null, ex); } }
/** * Displays the dialog to create a new employee account. * * @throws IOException */ @FXML private void onAddNewEmployeeButtonClicked() throws IOException { Stage dialogStage = new Stage(); Parent dialogRoot = FXMLLoader.load( getClass().getResource("/fxml/CreateStaffAccountDialog.fxml") ); Scene createStaffAccountDialog = new Scene(dialogRoot); dialogStage.getIcons().add(new Image("images/Logo.png")); dialogStage.setScene(createStaffAccountDialog); dialogStage.initModality(Modality.APPLICATION_MODAL); dialogStage.initOwner(addNewEmployeeButton.getScene().getWindow()); dialogStage.setResizable(false); dialogStage.setTitle("Create employee"); dialogStage.centerOnScreen(); dialogStage.show(); }
private void displayScoreScreen() { try { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ScoreFXML.fxml")); Parent root1 = (Parent) fxmlLoader.load(); ScoreFXMLController scireCtrl = fxmlLoader.getController(); scireCtrl.setBoard(playG.getBoard()); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setTitle("Résultats"); stage.setScene(new Scene(root1)); stage.showAndWait(); } catch (IOException ex) { Logger.getLogger(PlayGraphic.class.getName()).log(Level.SEVERE, null, ex); } }
public void showDialog() { FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/diff/diff-view.fxml")); try { loader.setController(diffController); DialogPane root = loader.load(); root.getStylesheets().add(getClass().getResource("/gui/diff/diff-view.css").toExternalForm()); Alert alert = new Alert(Alert.AlertType.WARNING); alert.setTitle("Diff Viewer"); alert.setResizable(true); alert.setDialogPane(root); alert.initModality(Modality.WINDOW_MODAL); Window window = alert.getDialogPane().getScene().getWindow(); window.setOnCloseRequest(event -> window.hide()); alert.showAndWait(); } catch (IOException e) { e.printStackTrace(); } }
public static void display(String title, String message) { Stage window= new Stage(); window.initModality(Modality.APPLICATION_MODAL); //window.setAlwaysOnTop(true); window.getIcons().add(new Image("/pic/slogo.png")); window.setTitle(title); Label label= new Label(); label.setText(message); label.setStyle("-fx-font-size:14px;"); ImageView imageView = new ImageView(ICON); imageView.setFitWidth(40); imageView.setFitHeight(40); Label labelimage = new Label("",imageView); // two buttons Button okbtn= new Button("Ok"); okbtn.setOnAction(e -> { answer= false; window.close(); }); okbtn.setId("red"); HBox hbox= new HBox(10); hbox.setAlignment(Pos.CENTER_LEFT); hbox.setPadding(new Insets(10,5,10,5)); hbox.getChildren().addAll(labelimage,label); VBox layout= new VBox(15); layout.setAlignment(Pos.CENTER_RIGHT); layout.setPadding(new Insets(10,5,10,5)); layout.getChildren().addAll(hbox,okbtn); layout.setStyle("-fx-background-color: linear-gradient(#E4EAA2, #9CD672);"); Scene scene= new Scene(layout); scene.getStylesheets().add(ErrorMessage.class.getResource("confirm.css").toExternalForm()); window.setScene(scene); window.setResizable(false); window.showAndWait(); }
@Override protected void humanActions(Player p) { try { FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("ActionsFXML.fxml")); Parent root1 = (Parent) fxmlLoader.load(); ActionsFXMLController actionCtrl = fxmlLoader.getController(); actionCtrl.setPlayer(p); actionCtrl.setBackground(background); Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); //Pour click sur close de action stage.setOnCloseRequest((WindowEvent event) -> { // consume event event.consume(); // show close dialog Alert alert = new Alert(AlertType.ERROR); alert.setTitle("Pas de précipitation !"); alert.setHeaderText(null); alert.setContentText("Vous devez choisir 6 actions !\nNe pas oublier de choisir la région pour les délégations."); alert.showAndWait(); }); stage.setTitle("Choix des actions"); stage.setScene(new Scene(root1)); stage.showAndWait(); } catch (IOException ex) { Logger.getLogger(PlayGraphic.class.getName()).log(Level.SEVERE, null, ex); } }
/** * Exchanges a letter with the bag */ @FXML protected void handleExchangeLetterWithBag() { try { this.refreshScrabbleInterface(); // Load letters exchanging view FXMLLoader loader = new FXMLLoader(); loader.setResources(this.scrabble.getI18nMessages()); loader.setLocation(Scrabble.class.getResource("view/ExchangeLetter.fxml")); VBox page = loader.load(); // Create the dialog stage Stage dialogStage = new Stage(); dialogStage.setMinWidth(ExchangeLettersController.EXCHANGE_LETTERS_STAGE_WIDTH); dialogStage.setMaxWidth(ExchangeLettersController.EXCHANGE_LETTERS_STAGE_WIDTH); dialogStage.setMinHeight(ExchangeLettersController.EXCHANGE_LETTERS_STAGE_HEIGHT); dialogStage.setMaxHeight(ExchangeLettersController.EXCHANGE_LETTERS_STAGE_HEIGHT); dialogStage.setTitle(this.scrabble.getI18nMessages().getString("exchangeLettersWithTheBag")); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(this.scrabble.getPrimaryStage()); Scene scene = new Scene(page); dialogStage.setScene(scene); ExchangeLettersController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setScrabble(this.scrabble); controller.initializeInterface(); dialogStage.showAndWait(); this.refreshLetters(); } catch (IOException e) { this.scrabble.showGeneralApplicationError(e); } }
/** * Display the 'Add Activity' window * * @return newly created Activity */ public Activity addActivity() throws Exception { ActivityController ac = new ActivityController(); // Load in the .fxml file: FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/Activity.fxml")); loader.setController(ac); Parent root = loader.load(); // Set the scene: Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setScene(new Scene(root, 550, 358)); stage.setTitle("New Activity"); stage.resizableProperty().setValue(false); stage.getIcons().add(new Image("file:icon.png")); stage.showAndWait(); // Add the Activity to the StudyPlanner if (ac.isSuccess()) return ac.getActivity(); return null; }
@FXML private void handleMenuAbout(ActionEvent event) { val stage = new Stage(); stage.setTitle("About"); stage.setResizable(false); stage.initOwner(primaryStage); stage.initModality(Modality.WINDOW_MODAL); try { val loader = new FXMLLoader(getClass().getResource("/fxml/About.fxml")); val scene = new Scene(loader.load()); scene.getStylesheets().addAll( getClass().getResource("/styles/theme-dark.css").toExternalForm(), getClass().getResource("/styles/about.css").toExternalForm() ); stage.setScene(scene); stage.show(); } catch (Exception e) { showError("Unable to open about window"); } }
/** * Displays the 'Add Milestone' window. * * @return newly created Milestone object. */ public Milestone addMilestone() throws IOException { MilestoneController mc = new MilestoneController(); // Load in the .fxml file: FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/Milestone.fxml")); loader.setController(mc); Parent root = loader.load(); // Set the scene: Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setScene(new Scene(root, 550, 355)); stage.setTitle("Milestone"); stage.resizableProperty().setValue(false); stage.getIcons().add(new Image("file:icon.png")); stage.showAndWait(); // Add the Milestone to the StudyPlanner if (mc.isSuccess()) return mc.getMilestone(); return null; }
public static boolean showEditQuestionDialog(Stage ps,Question question,String title){ try { // Load the fxml file and create a new stage for the popup dialog. FXMLLoader loader = new FXMLLoader(); loader.setLocation(MainApp.class.getResource("view_controller/EditQuestion.fxml")); GridPane page = loader.load(); // Create the dialog Stage. Stage dialogStage = new Stage(); dialogStage.setTitle(title); dialogStage.getIcons().add(new Image(MainApp.class.getResourceAsStream("resources/icon.png"))); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(ps); Scene scene = new Scene(page); dialogStage.setScene(scene); dialogStage.setWidth(450); dialogStage.setHeight(700); dialogStage.setResizable(false); // Set the question into the controller. EditQuestionCtrl controller = loader.getController(); controller.dialogStage = dialogStage; controller.setQuestion(question); // Show the dialog and wait until the user closes it dialogStage.showAndWait(); return controller.okClicked; } catch (IOException e) { e.printStackTrace(); return false; } }
public SettingsWindow(Stage parent) throws IOException { super(StageStyle.UNDECORATED); prefs = Preferences.userNodeForPackage(App.class); // Load root layout from fxml file. FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/settings_menu.fxml")); loader.setController(this); this.initModality(Modality.WINDOW_MODAL); this.initOwner(parent); this.setAlwaysOnTop(true); TabPane layout = loader.load(); Scene scene2 = new Scene(layout); this.setScene(scene2); this.setTitle("LMSGrabber Settings"); min_delay_slider.setValue(prefs.getDouble("min_delay", 1.0)); max_delay_slider.setValue(prefs.getDouble("max_delay", 3.0)); input_proxy.setText(prefs.get("proxy", "")); multithreaded_check.setSelected(prefs.getBoolean("multithreaded", true)); }
@FXML private void hlForgetPassword(ActionEvent event) { try { Parent root = FXMLLoader.load(getClass().getResource("/view/auth/ForgetPassword.fxml")); root.getStylesheets().add("../css/main.css"); Scene scene = new Scene(root); Stage stage = new Stage(); stage.setTitle("Dr Assistant (Desktop Edition) - Forget Password"); stage.setScene(scene); stage.setResizable(false); stage.initModality(Modality.APPLICATION_MODAL); stage.show(); } catch (IOException ex) { Logger.getLogger(LoginController.class.getName()).log(Level.SEVERE, null, ex); } }
/** * Displays the Milestone details page * * @param milestone Milestone for which the details should be shown. */ public void milestoneDetails(Milestone milestone) throws IOException { MilestoneController mc = new MilestoneController(milestone); // Load in the .fxml file: FXMLLoader loader = new FXMLLoader(getClass().getResource("/View/Milestone.fxml")); loader.setController(mc); Parent root = loader.load(); // Set the scene: Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setScene(new Scene(root, 550, 355)); stage.setTitle("Milestone"); stage.resizableProperty().setValue(false); stage.getIcons().add(new Image("file:icon.png")); stage.showAndWait(); }