コード例 #1
1
  public boolean showChapitreAddDialog(Chapitre chapitre, int id) {
    try {
      // Load the fxml file and create a new stage for the popup dialog.
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(MainApp.class.getResource("/fxml/addChapitre.fxml"));
      AnchorPane page = (AnchorPane) loader.load();

      // Create the dialog Stage.
      Stage dialogStage = new Stage();
      dialogStage.setTitle("Ajouter un Cours");
      dialogStage.initModality(Modality.APPLICATION_MODAL);
      dialogStage.initStyle(StageStyle.UTILITY);
      dialogStage.initOwner(primaryStage);
      Scene scene = new Scene(page);
      dialogStage.setScene(scene);

      // Set the cours into the controller.
      AddChapitreController controller = loader.getController();
      controller.setDialogStage(dialogStage);
      controller.setChapitre(chapitre, id);

      // Show the dialog and wait until the user closes it
      dialogStage.showAndWait();

      return controller.isOkClicked();
    } catch (IOException e) {
      e.printStackTrace();
      return false;
    }
  }
コード例 #2
0
 private boolean validateText(String text) {
   try {
     int i = Integer.parseInt(text);
     if (i > 50 || i < 0) {
       Stage dialogStage = new Stage();
       dialogStage.initModality(Modality.WINDOW_MODAL);
       dialogStage.setScene(
           new Scene(
               VBoxBuilder.create()
                   .children(new Text("Wartoœæ kroku musi byæ wiêksza od 0 oraz mniejsza od 50."))
                   .alignment(Pos.CENTER)
                   .padding(new Insets(25))
                   .build()));
       dialogStage.show();
       return false;
     }
   } catch (NumberFormatException nfe) {
     Stage dialogStage = new Stage();
     dialogStage.initModality(Modality.WINDOW_MODAL);
     dialogStage.setScene(
         new Scene(
             VBoxBuilder.create()
                 .children(new Text("Wpisana wartosc musi byc liczba calkowita"))
                 .alignment(Pos.CENTER)
                 .padding(new Insets(25))
                 .build()));
     dialogStage.show();
     return false;
   }
   return true;
 }
コード例 #3
0
  /**
   * Shows the progress dialog and start the progress of all the tasks while reading the file
   *
   * @param file
   */
  public void showProgressDialog(File file) {

    try {
      // Load the fxml file and create a new stage for the popup dialog.
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(SolarSizerAppMain.class.getResource("view/ProgressWindow.fxml"));
      AnchorPane page = (AnchorPane) loader.load();

      // Create the dialog Stage.
      progressDialogStage = new Stage();
      progressDialogStage.setTitle("Working...");
      progressDialogStage.initModality(Modality.WINDOW_MODAL);
      Scene scene = new Scene(page);
      progressDialogStage.setScene(scene);

      // Set the person into the controller.
      ProgressDialogController controller = loader.getController();
      controller.setFile(file);
      controller.setDataProcessedListener(this);
      // Show the dialog and wait until the user closes it
      progressDialogStage.show();
      // calls to process data
      controller.processData();

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
コード例 #4
0
  private void showError(List<String> errorList) {
    String msg = "";
    if (errorList.isEmpty()) {
      msg = "No message to display.";
    } else {
      for (String s : errorList) {
        msg = msg + s + "\n";
      }
    }
    Label msgLbl = new Label(msg);
    Button okBtn = new Button("OK");
    VBox root = new VBox(new StackPane(msgLbl), new StackPane(okBtn));
    root.setSpacing(10);

    Scene scene = new Scene(root);
    Stage stage = new Stage(StageStyle.UTILITY);
    stage.initModality(Modality.WINDOW_MODAL);
    stage.setScene(scene);
    stage.initOwner(view.getScene().getWindow());

    // Set the Action listener for the OK button
    okBtn.setOnAction(e -> stage.close());

    stage.setTitle("Error");
    stage.sizeToScene();
    stage.showAndWait();
  }
コード例 #5
0
ファイル: ErlyBerly.java プロジェクト: InoMurko/erlyberly
  private void displayConnectionPopup(Stage primaryStage) {
    Stage connectStage;

    connectStage = new Stage();
    connectStage.initModality(Modality.WINDOW_MODAL);
    connectStage.setScene(new Scene(new FxmlLoadable("/erlyberly/connection.fxml").load()));
    connectStage.setAlwaysOnTop(true);

    // javafx vertical resizing is laughably ugly, lets just disallow it
    connectStage.setResizable(false);
    connectStage.setWidth(400);

    // if the user closes the window without connecting then close the app
    connectStage.setOnCloseRequest(
        new EventHandler<WindowEvent>() {
          @Override
          public void handle(WindowEvent e) {
            if (!nodeAPI.connectedProperty().get()) {
              Platform.exit();
            }

            Platform.runLater(
                () -> {
                  primaryStage.setResizable(true);
                });
          }
        });

    connectStage.show();
  }
コード例 #6
0
  public SQLHistorySearchCtrl(
      SQLTextAreaServices sqlTextAreaServices,
      Session session,
      ObservableList<SQLHistoryEntry> items) {
    _sqlTextAreaServices = sqlTextAreaServices;

    FxmlHelper<SQLHistorySearchView> fxmlHelper = new FxmlHelper<>(SQLHistorySearchView.class);
    _view = fxmlHelper.getView();

    _dialog = new Stage();
    _dialog.setTitle(
        new I18n(getClass())
            .t("SQLHistorySearchCtrl.title", session.getMainTabContext().getSessionTabTitle()));
    _dialog.initModality(Modality.WINDOW_MODAL);
    _dialog.initOwner(AppState.get().getPrimaryStage());
    Region region = fxmlHelper.getRegion();
    _dialog.setScene(new Scene(region));

    GuiUtils.makeEscapeClosable(region);

    new StageDimensionSaver(
        "sqlhistorysearch",
        _dialog,
        new Pref(getClass()),
        region.getPrefWidth(),
        region.getPrefHeight(),
        _dialog.getOwner());

    _view.cboFilterType.setItems(
        FXCollections.observableList(Arrays.asList(SqlHistoryFilterType.values())));
    _view.cboFilterType.getSelectionModel().selectFirst();

    _view.btnApply.setOnAction(e -> onApply());
    _view.chkFiltered.setOnAction(e -> onChkFiltered());

    _view.split.getItems().add(_tblHistory);
    _view.split.getItems().add(_txtSqlPreview);

    _originalTableLoader = new RowObjectTableLoader<>();
    _originalTableLoader.initColsByAnnotations(SQLHistoryEntry.class);
    _originalTableLoader.addRowObjects(items);
    _currentLoader = _originalTableLoader.cloneLoader();
    _currentLoader.load(_tblHistory);

    _tblHistory
        .getSelectionModel()
        .selectedItemProperty()
        .addListener((observable, oldValue, newValue) -> onTableSelectionChanged());

    _tblHistory.setOnMouseClicked(e -> onTblHistoryClicked(e));

    _txtSqlPreview.setEditable(false);

    _dialog.setOnCloseRequest(e -> close());

    _view.txtFilter.requestFocus();

    _splitPositionSaver.apply(_view.split);
    _dialog.showAndWait();
  }
コード例 #7
0
ファイル: TRLauncher.java プロジェクト: RX14/Launcher
  public DownloadDialogController showDownloadDialog(Modpack modpack) {
    try {
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(TRLauncher.class.getResource("view/downloaddialog/DownloadDialog.fxml"));

      AnchorPane pane = loader.load();

      Stage dialogStage = new Stage();
      dialogStage.setTitle("Downloading Modpack");
      dialogStage.initModality(Modality.WINDOW_MODAL);
      dialogStage.initOwner(primaryStage);
      Scene scene = new Scene(pane);
      dialogStage.setScene(scene);

      DownloadDialogController controller = loader.getController();
      controller.setDialogStage(dialogStage);
      controller.setModpack(modpack);

      controller.setDownloadingLabelText("Downloading " + modpack.getDisplayName());

      dialogStage.show();

      try {
        Thread.sleep(4000);
      } catch (InterruptedException e) {
        e.printStackTrace();
      }

      return controller;
    } catch (IOException e) {
      System.err.println("Couldn't find the specified layout");
      e.printStackTrace();
      return null;
    }
  }
コード例 #8
0
  public void storeEntry() {
    Stage window = new Stage();
    Button button;

    Label label = new Label("Please enter the item UPC");
    Label label2 = new Label("Please enter the item's location");

    window.initModality(Modality.APPLICATION_MODAL);
    window.setTitle("Save an item");
    window.setWidth(300);
    window.setHeight(400);

    final TextField upcInput = new TextField();
    final TextField locationInput = new TextField();
    button = new Button("Save");
    button.setOnAction(
        e -> {
          try {
            itemUPC = Double.parseDouble(upcInput.getText());
            itemLOC = locationInput.getText();
          } catch (Exception f) {
            displaySimple("Bad input", "Please enter valid inputs");
            status = false;
          }
          window.close();
        });

    VBox layout = new VBox(20);
    layout.getChildren().addAll(label, upcInput, label2, locationInput, button);
    layout.setAlignment(Pos.CENTER);

    Scene scene = new Scene(layout);
    window.setScene(scene);
    window.showAndWait();
  }
コード例 #9
0
  /** Opens the filter window to enable filters. */
  public boolean filters() {
    try {
      String filters = "/java_ebook_search/view/FiltersView.fxml";
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(getClass().getResource(filters));
      AnchorPane page = loader.load();
      Stage dialogStage = new Stage();
      dialogStage.setTitle("Filters");
      dialogStage.initModality(Modality.APPLICATION_MODAL);
      dialogStage.setResizable(false);
      dialogStage.initOwner(searchView.getParent().getScene().getWindow());
      Scene scene = new Scene(page);
      dialogStage.setScene(scene);

      // Set the Filter into the controller.
      FiltersController controller = loader.getController();
      controller.setDialogStage(dialogStage);
      if (null != filter) {
        controller.setFilter(filter);
      }

      // Show the dialog and wait until the user closes it
      dialogStage.showAndWait();
      // Set Filters
      this.filter = controller.getFilter();

      // Trigger search
      search();
      return controller.isOkClicked();
    } catch (IOException | ParseException e) {
      e.printStackTrace();
      return false;
    }
  }
コード例 #10
0
  public FXDialog() {
    // Setup general stage and main grid
    msgLabel = detLabel = null;
    stage = new Stage();
    stage.initModality(Modality.WINDOW_MODAL);
    grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(10, 10, 10, 10));

    // Add the OK button (it's a default)
    buttonArea = new HBox(10);
    Button okBtn = new Button("OK");
    okBtn.setOnAction(
        event -> {
          okPressed = true;
          stage.hide();
        });
    buttonArea.getChildren().add(okBtn);
    grid.add(buttonArea, 1, 2);

    // ImageView imageView = new ImageView();
    // grid.add(imageView, 0, 0);

    // Add a 50 width pane for spacing and also as we plan on adding an image at 0,0
    // some time in the future
    Pane pane = new Pane();
    pane.setMinWidth(50);
    grid.add(pane, 0, 1);

    stage.setScene(new Scene(grid, 250, 100));
    okPressed = false;
  }
コード例 #11
0
ファイル: Main.java プロジェクト: olehpitsun/BioImageTesting
  public boolean showDbConnectDialog() {
    try {
      // Load the fxml file and create a new stage for the popup dialog.
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(Main.class.getResource("view/DbConnectDialog.fxml"));
      AnchorPane page = (AnchorPane) loader.load();

      // Create the dialog Stage.
      Stage dialogStage = new Stage();
      dialogStage.setTitle("Під'єднання до БД");
      dialogStage.initModality(Modality.WINDOW_MODAL);
      dialogStage.initOwner(primaryStage);
      Scene scene = new Scene(page);
      dialogStage.setScene(scene);

      // Set the person into the controller.
      sample.view.DbConnectDialogController controller = loader.getController();
      controller.setDialogStage(dialogStage);
      controller.setConnectField();

      // Set the dialog icon.
      dialogStage.getIcons().add(new Image("file:resources/images/edit.png"));

      // Show the dialog and wait until the user closes it
      dialogStage.showAndWait();

      return controller.isOkClicked();
    } catch (IOException e) {
      e.printStackTrace();
      return false;
    }
  }
コード例 #12
0
ファイル: ShowArchives.java プロジェクト: ricikay93/LabSys
  public static void showArchives(Stage s) {
    try {
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(ShowArchives.class.getResource("./fxml/archiveView.fxml"));

      Parent root = (Parent) loader.load();
      ShowArchives section = loader.getController();

      Scene scene = new Scene(root);

      Stage stage = new Stage();
      stage.setScene(scene);
      section.setParent(stage);
      section.loadInfo();

      stage.initOwner(s);
      stage.initModality(Modality.APPLICATION_MODAL);
      stage.setResizable(false);
      stage.initStyle(StageStyle.UTILITY);

      stage.showAndWait();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
コード例 #13
0
ファイル: MainApp.java プロジェクト: cedricselph/PS_4
  public boolean showPersonEditDialog(Person person) {
    try {
      // Load the fxml file and create a new stage for the popup dialog.
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(MainApp.class.getResource("view/PersonEditDialog.fxml"));
      AnchorPane page = (AnchorPane) loader.load();

      // Create the dialog Stage.
      Stage dialogStage = new Stage();
      dialogStage.setTitle("Edit Person");
      dialogStage.initModality(Modality.WINDOW_MODAL);
      dialogStage.initOwner(primaryStage);
      Scene scene = new Scene(page);
      dialogStage.setScene(scene);

      // Set the person into the controller.
      PersonEditDialogController controller = loader.getController();
      controller.setDialogStage(dialogStage);
      controller.setPerson(person);

      // Show the dialog and wait until the user closes it
      dialogStage.showAndWait();

      return controller.isOkClicked();
    } catch (IOException e) {
      e.printStackTrace();
      return false;
    }
  }
コード例 #14
0
  public static boolean display(String title, String message) {
    Stage window = new Stage();
    window.initModality(Modality.APPLICATION_MODAL);

    Label l1 = new Label(message);

    // Create 2 buttons
    Button yesBtn = new Button("Yes");
    Button noBtn = new Button("No");

    yesBtn.setOnAction(
        e -> {
          ans = true;
          window.close();
        });

    noBtn.setOnAction(
        e -> {
          ans = false;
          window.close();
        });

    HBox hbox = new HBox(10);
    hbox.getChildren().addAll(l1, yesBtn, noBtn);
    hbox.setAlignment(Pos.CENTER);

    Scene sc = new Scene(hbox);

    window.setScene(sc);
    window.setTitle(title);
    window.setMinWidth(250);
    window.showAndWait();

    return ans;
  }
コード例 #15
0
  @FXML
  private void HandleFindReplaceDialog() {
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(MainApp.class.getResource("fxml/FindReplaceDialog.fxml"));

    try {
      AnchorPane optionsDialog = loader.load();

      Stage dialogStage = new Stage();
      dialogStage.setTitle("Rechecher / Remplacer");

      Scene scene = new Scene(optionsDialog);
      dialogStage.setScene(scene);
      dialogStage
          .getIcons()
          .add(new Image(MainApp.class.getResourceAsStream("assets/static/icons/logo.png")));
      dialogStage.setResizable(false);
      dialogStage.initModality(Modality.APPLICATION_MODAL);

      FindReplaceDialog findReplaceDialog = loader.getController();
      findReplaceDialog.setMainApp(mainApp);
      findReplaceDialog.setWindow(dialogStage);
      findReplaceDialog.setMdConvertController(this);

      dialogStage.show();
    } catch (IOException e) {
      logger.error(e.getMessage(), e);
    }
  }
コード例 #16
0
  private void showObjectifDialog(int id) {
    try {
      // Load the fxml file and create a new stage for the popup dialog.
      System.out.println("hello");
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(MainApp.class.getResource("/fxml/displayObjectif.fxml"));
      AnchorPane page = (AnchorPane) loader.load();

      // Create the dialog Stage.
      Stage dialogStage = new Stage();
      dialogStage.setTitle("Objectif");
      dialogStage.initModality(Modality.APPLICATION_MODAL);
      dialogStage.initStyle(StageStyle.UTILITY);
      dialogStage.initOwner(primaryStage);
      Scene scene = new Scene(page);
      dialogStage.setScene(scene);

      // Set the cours into the controller.
      DisplayObjectifController control = loader.getController();
      control.setDialogStage(dialogStage);
      control.setObjectif(id);

      // Show the dialog and wait until the user closes it
      dialogStage.showAndWait();

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
コード例 #17
0
ファイル: MainController.java プロジェクト: jforge/mqtt-spy
  private void initialiseEditConnectionsWindow() {
    // This is a dirty way to reload connection settings :) possibly could be removed if all
    // connections are closed before loading a new config file
    if (editConnectionsController != null) {
      eventManager.deregisterConnectionStatusObserver(editConnectionsController);
    }

    final FXMLLoader loader =
        FxmlUtils.createFxmlLoaderForProjectFile("EditConnectionsWindow.fxml");
    final AnchorPane connectionWindow = FxmlUtils.loadAnchorPane(loader);
    editConnectionsController = ((EditConnectionsController) loader.getController());
    editConnectionsController.setMainController(this);
    editConnectionsController.setEventManager(eventManager);
    editConnectionsController.setConnectionManager(connectionManager);
    editConnectionsController.setConfigurationManager(configurationManager);
    editConnectionsController.init();

    Scene scene = new Scene(connectionWindow);
    scene.getStylesheets().addAll(mainPane.getScene().getStylesheets());

    editConnectionsStage = new Stage();
    editConnectionsStage.setTitle("Connection list");
    editConnectionsStage.initModality(Modality.WINDOW_MODAL);
    editConnectionsStage.initOwner(getParentWindow());
    editConnectionsStage.setScene(scene);
  }
コード例 #18
0
  @Override
  @FXML
  protected void abrirModalCreate() {
    try {
      // Carrega o arquivo fxml e cria um novo stage para a janela popup.
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(getClass().getResource("fxml/dialog/dialogFuncionario.fxml"));
      GridPane page = (GridPane) loader.load();

      // Cria o palco dialogStage.
      Stage dialogStage = new Stage();
      dialogStage.initModality(Modality.WINDOW_MODAL);
      dialogStage.initOwner(ControllerTelas.stage);
      Scene scene = new Scene(page);
      dialogStage.setScene(scene);

      // Define a pessoa no controller.
      DialogController<Funcionario> controller = loader.getController();
      controller.setTipe(DialogController.CREATE_MODAL);
      controller.setDialogStage(dialogStage);
      dialogStage.setTitle(controller.getTitulo());
      dialogStage.setResizable(false);
      // Mostra a janela e espera até o usuário fechar.
      dialogStage.showAndWait();

      tabela.getItems().clear();
      atualizarLista();

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  /**
   * Displays dialog that allows user to select local text file to display in TextArea
   *
   * @param ta - reference to TextArea to display loaded text file
   */
  public void showLoadFileDialog(AutoSpellingTextArea ta) {
    try {
      // Load the fxml file and create a new stage for the popup
      FXMLLoader loader = new FXMLLoader(MainApp.class.getResource("view/LoadFileLayout.fxml"));
      VBox page = (VBox) loader.load();
      Stage dialogStage = new Stage();
      dialogStage.setTitle("Load File");
      dialogStage.initModality(Modality.WINDOW_MODAL);
      dialogStage.initOwner(primaryStage);
      Scene scene = new Scene(page);
      dialogStage.setScene(scene);

      // Set reference to stage in controller
      LoadFileDialogController controller = loader.getController();
      controller.setDialogStage(dialogStage);

      // give controller reference to text area to load file into
      controller.setTextArea(ta);

      // Show the dialog and wait until the user closes it
      dialogStage.showAndWait();

    } catch (IOException e) {
      // Exception gets thrown if the fxml file could not be loaded
      e.printStackTrace();
    }
  }
  public void showEditDistanceDialog(String selectedText) {
    try {
      // Load the fxml file and create a new stage for the popup
      FXMLLoader loader = new FXMLLoader(MainApp.class.getResource("view/EditDistanceLayout.fxml"));
      VBox page = (VBox) loader.load();
      Stage dialogStage = new Stage();
      dialogStage.setTitle("Calculate Edit Distance");
      dialogStage.initModality(Modality.WINDOW_MODAL);
      dialogStage.initOwner(primaryStage);
      Scene scene = new Scene(page);
      dialogStage.setScene(scene);

      // Set reference to stage in controller
      EditDistanceDialogController controller = loader.getController();
      controller.setDialogStage(dialogStage);
      controller.setMainApp(this);
      controller.setField(selectedText);

      // give controller reference to scene (cursor)

      // Show the dialog and wait until the user closes it
      dialogStage.showAndWait();

    } catch (IOException e) {
      // Exception gets thrown if the fxml file could not be loaded
      e.printStackTrace();
    }
  }
  public void onFilterActivated() {
    try {
      FXMLLoader filterDialogFile =
          new FXMLLoader(MainApp.class.getResource("view/FilterDialog.fxml"));
      ResourceBundleService.setResourceBundle(filterDialogFile);
      AnchorPane anchorPane = filterDialogFile.load();

      Stage stage = new Stage();
      stage.setResizable(false);
      stage.setTitle(_resources.getString("filter.dialog.title"));
      stage.getIcons().add(_mainApp.getApplicationIcon());
      stage.initModality(Modality.WINDOW_MODAL);
      stage.initOwner(_mainApp.getPrimaryStage());

      stage.setScene(new Scene(anchorPane));

      FilterDialogController controller = filterDialogFile.getController();
      controller.setMainApp(_mainApp);
      controller.setOwner(stage);

      stage.showAndWait();
    } catch (IOException ioEx) {
      ExceptionDialog.show(
          _resources.getString("app.error.dialog.title"),
          _resources.getString("app.error.dialog.header"),
          _resources.getString("app.error.dialog.content.filter"),
          ioEx,
          _mainApp);
    }
  }
コード例 #22
0
  public PasswordRetryDialogController showPasswordDialog(String username, String failureMessage) {
    try {
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(
          TRLauncher.class.getResource("view/passworddialog/retry/PasswordRetryDialog.fxml"));

      AnchorPane pane = loader.load();

      Stage dialogStage = MiscUtils.addIcons(new Stage());
      dialogStage.setTitle("Login (Retry)");
      dialogStage.initModality(Modality.WINDOW_MODAL);
      dialogStage.initOwner(primaryStage);
      Scene scene = new Scene(pane);
      dialogStage.setScene(scene);

      PasswordRetryDialogController controller = loader.getController();
      controller.setDialogStage(dialogStage);
      controller.setUsername(username);
      controller.setFailureMessage(failureMessage);

      dialogStage.showAndWait();

      return controller;

    } catch (IOException e) {
      TRLauncher.log.error("Couldn't find the specified layout");
      TRLauncher.log.catching(e);
      Issues.create(null, e);
      return null;
    }
  }
コード例 #23
0
  public void customerEntry() {
    Stage window = new Stage();
    Button button;

    Label label = new Label("Please enter the item you are searching for");
    window.initModality(Modality.APPLICATION_MODAL);
    window.setTitle("Find an item");
    window.setWidth(400);
    window.setHeight(400);

    final TextField nameInput = new TextField();
    button = new Button("Find");
    button.setOnAction(
        e -> {
          try {
            userEntry = nameInput.getText();
          } catch (Exception f) {
            displaySimple("Bad input", "Please enter valid inputs");
            status = false;
          }
          window.close();
        });

    VBox layout = new VBox(20);
    layout.getChildren().addAll(label, nameInput, button);
    layout.setAlignment(Pos.CENTER);

    Scene scene = new Scene(layout);
    window.setScene(scene);
    window.showAndWait();
  }
コード例 #24
0
  public String showSetUsernameDialog() {
    try {
      FXMLLoader loader = new FXMLLoader();
      loader.setLocation(TRLauncher.class.getResource("view/account/SetUsername.fxml"));

      AnchorPane pane = loader.load();

      Stage dialogStage = MiscUtils.addIcons(new Stage());
      dialogStage.setTitle("Add Account");
      dialogStage.initModality(Modality.WINDOW_MODAL);
      dialogStage.initOwner(primaryStage);
      Scene scene = new Scene(pane);
      dialogStage.setScene(scene);

      SetUsernameController controller = loader.getController();
      controller.setDialogStage(dialogStage);

      dialogStage.showAndWait();

      return controller.getUsername();

    } catch (IOException e) {
      TRLauncher.log.error("Couldn't find the specified layout");
      TRLauncher.log.catching(e);
      Issues.create(null, e);
      return null;
    }
  }
コード例 #25
0
  public void storeLogin() {
    Stage window = new Stage();
    Button button;
    String password = "******";

    Label label = new Label("Please enter the store password");

    window.initModality(Modality.APPLICATION_MODAL);
    window.setTitle("Store Login");
    window.setWidth(300);
    window.setHeight(200);

    final TextField passWordInput = new TextField();
    button = new Button("Enter");
    button.setOnAction(
        e -> {
          String entry = passWordInput.getText();
          if (entry.equalsIgnoreCase(password)) {
            answer = true;
            window.close();
          } else {
            answer = false;
            window.close();
          }
        });

    VBox layout = new VBox(20);
    layout.getChildren().addAll(label, passWordInput, button);
    layout.setAlignment(Pos.CENTER);

    Scene scene = new Scene(layout);
    window.setScene(scene);
    window.showAndWait();
  }
コード例 #26
0
 private SplashScreen(GriffonApplication app) {
   stage = new Stage();
   stage.initModality(Modality.APPLICATION_MODAL);
   stage.initStyle(StageStyle.TRANSPARENT);
   stage.setScene(createScene(app));
   stage.sizeToScene();
 }
コード例 #27
0
  public static boolean display(String title, String message) {
    Stage window = new Stage();
    answer = false;

    // Block events to other windows. means don't allow control of the first window untill this
    // window is closed.
    window.initModality(Modality.APPLICATION_MODAL);
    window.setTitle(title);
    window.setMinWidth(250);

    Label label = new Label();
    label.setText(message);

    // Create two buttons
    Button yesButton = new Button("Yes");
    Button noButton = new Button("No");
    yesButton.setOnAction(
        e -> {
          answer = true;
          window.close();
        });
    noButton.setOnAction(e -> window.close());

    VBox layout = new VBox(10);
    layout.getChildren().addAll(label, yesButton, noButton);
    layout.setAlignment(Pos.CENTER);

    // Display window and wait for it to be closed before returning
    Scene scene = new Scene(layout);
    window.setScene(scene);
    //        window.show();
    window.showAndWait(); // show the window & wait unitl it's closed

    return answer;
  }
コード例 #28
0
  public AbstractDialog() {
    dialogStage = new Stage();

    dialogStage.initStyle(StageStyle.UTILITY);
    dialogStage.initModality(Modality.APPLICATION_MODAL);

    dialogStage.setOnShown(this::onShownHandler);
    dialogStage.iconifiedProperty().addListener(this::onIconifiedChanged);
  }
コード例 #29
0
 public ServerConnectorDialog(Stage parent) {
   stage = new Stage();
   ResourceBundle resourceBundle = ResourceBundle.getBundle(getClass().getCanonicalName());
   stage.setTitle(resourceBundle.getString("dialogTitle"));
   stage.initModality(Modality.APPLICATION_MODAL);
   stage.initOwner(parent);
   serverConnectorView = new ServerConnectorView(stage);
   stage.setScene(new Scene(new Group(serverConnectorView), 500, 500));
 }
コード例 #30
0
 // ao precionar o botão entrar
 public void entrarSistema(ActionEvent event) throws IOException {
   FXMLLoader fxmlLoader =
       new FXMLLoader(getClass().getResource("/application/JanelaInterna.fxml"));
   Parent root = fxmlLoader.load();
   Stage stage = new Stage();
   stage.initModality(Modality.APPLICATION_MODAL);
   stage.setOpacity(1);
   stage.setScene(new Scene(root));
   stage.showAndWait();
 }