/*
  /Check of de naam in de database gelijk is aan de textveld tfBeginUsername
  */
  @FXML
  public void Login() throws IOException, SQLException, NotBoundException {
    try {
      // check if the user is already online.
      for (User usr : loginIn.getOnlineUsers()) {
        if (usr.getName().equals(tfBeginUsername.getText())) {
          Alert alert = new Alert(AlertType.INFORMATION);
          alert.setTitle("Information");
          alert.setHeaderText(null);
          alert.setContentText("User is already online");
          alert.showAndWait();

        } else if (loginIn.Login(tfBeginUsername.getText(), tfBeginPassword.getText()) != null) {
          user = loginIn.Login(tfBeginUsername.getText(), tfBeginPassword.getText());
          LobbySession.user = user;
          userName = user.getName();
          LbLobbyUserName.textProperty().bind(userNameProperty);
          loginIn.addToOnline(LobbySession.user);
          stage = (Stage) btBeginLogIn.getScene().getWindow();
          root = FXMLLoader.load(getClass().getResource("Lobby.fxml"));
          Scene scene = new Scene(root);
          scene.getStylesheets().add((new File("css/Lobby.css")).toURI().toURL().toExternalForm());
          stage.setScene(scene);
          stage.setResizable(false);
          stage.show();

        } else {
          Alert alert = new Alert(AlertType.INFORMATION);
          alert.setTitle("Information");
          alert.setHeaderText(null);
          alert.setContentText("Please enter correct name and password");
          alert.showAndWait();
        }
      }
      if (loginIn.getOnlineUsers().isEmpty()) {
        user = loginIn.Login(tfBeginUsername.getText(), tfBeginPassword.getText());
        LobbySession.user = user;
        userName = user.getName();
        LbLobbyUserName.textProperty().bind(userNameProperty);
        loginIn.addToOnline(LobbySession.user);
        stage = (Stage) btBeginLogIn.getScene().getWindow();
        root = FXMLLoader.load(getClass().getResource("Lobby.fxml"));
        Scene scene = new Scene(root);
        scene.getStylesheets().add((new File("css/Lobby.css")).toURI().toURL().toExternalForm());
        stage.setScene(scene);
        stage.setResizable(false);
        stage.show();
      }
    } catch (Exception ex) {
      System.out.println("Not working: " + ex);
    }
  }
  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;
    }
  }
  @FXML
  void actionComboBoxHandler(ActionEvent event) throws IOException {

    Parent parent;
    int selectedIndex = actionComboBox.getSelectionModel().getSelectedIndex();
    String title = actionComboBox.getSelectionModel().getSelectedItem();

    // Switch to a different scene based on choice selected by user
    switch (selectedIndex) {
      case 0:
        parent = FXMLLoader.load(getClass().getResource("/fxml/AddPlayer.fxml"));
        break;
      case 1:
        parent = FXMLLoader.load(getClass().getResource("/fxml/AddGame.fxml"));
        break;
      case 2:
        parent = FXMLLoader.load(getClass().getResource("/fxml/UpdatePlayer.fxml"));
        break;
      case 3:
        parent = FXMLLoader.load(getClass().getResource("/fxml/DisplayPlayerGame.fxml"));
        break;
      default:
        parent = FXMLLoader.load(getClass().getResource("/fxml/MainWindow.fxml"));
        break;
    }

    // Set scene
    super.setScreen(event, parent, title);
  }
 // Loads the appropriate layout for the pane
 private void loadNode(String tab) {
   Node node;
   getChildren().clear();
   try {
     if (tab.equals("Web")) {
       node =
           (Node)
               FXMLLoader.load(
                   getClass().getResource("resource/website/view/website_viewpane.fxml"));
       getChildren().add(node);
     } else if (tab.equals("Email")) {
       node =
           (Node)
               FXMLLoader.load(getClass().getResource("resource/email/view/email_viewpane.fxml"));
       getChildren().add(node);
     } else if (tab.equals("Apps")) {
       node =
           (Node) FXMLLoader.load(getClass().getResource("resource/apps/view/apps_viewpane.fxml"));
       getChildren().add(node);
     } else if (tab.equals("Bank")) {
       node =
           (Node)
               FXMLLoader.load(getClass().getResource("resource/bank/view/banks_viewpane.fxml"));
       getChildren().add(node);
     } else if (tab.equals("General")) {
       node = (Node) FXMLLoader.load(getClass().getResource("resource/general/contacts.fxml"));
       getChildren().add(node);
     }
   } catch (Exception e) {
     e.printStackTrace();
     node = null;
   }
 }
Example #5
0
  @Override
  public void start(Stage primaryStage) throws Exception {

    DeleteController dCtrl = new DeleteController();

    Parent editAlbum = null;
    FXMLLoader editAlbumLoader = new FXMLLoader();
    editAlbum = editAlbumLoader.load(getClass().getResource("/fxml/editAlbum.fxml").openStream());
    EditAlbumController eACtrl = editAlbumLoader.getController();
    eACtrl.setParent(editAlbum);
    if (eACtrl == null) System.out.println("edit album controllern är null");

    Parent addAlbum = null;
    FXMLLoader addAlbumLoader = new FXMLLoader();
    addAlbum = addAlbumLoader.load(getClass().getResource("/fxml/addAlbum.fxml").openStream());
    AddAlbumController aACtrl = addAlbumLoader.getController();
    aACtrl.setParent(addAlbum);
    if (aACtrl == null) System.out.println("add album controllern är null");

    Parent root = null;
    FXMLLoader loader = new FXMLLoader();
    System.out.println(getClass().getResource("/fxml/main.fxml"));
    root = loader.load(getClass().getResource("/fxml/main.fxml").openStream());
    MainController mCtrl = loader.getController();
    if (mCtrl == null) System.out.println("main controllern är null");

    mCtrl.setControllers(aACtrl, eACtrl, dCtrl);

    primaryStage.setTitle("Media Center");
    primaryStage.setScene(new Scene(root, 1280, 720));
    primaryStage.show();
  }
  @Override
  public void start(Stage stage) throws Exception {
    primaryStage = stage;

    primaryStage.setTitle("Générateur de trames de surveillances");

    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(Main.class.getResource("../../../zoo/generator/view/RootLayout.fxml"));

    try {
      rootLayout = loader.load();
      Scene scene = new Scene(rootLayout);
      primaryStage.setScene(scene);

      // Main panel
      FXMLLoader loader2 = new FXMLLoader();
      loader2.setLocation(Main.class.getResource("../../../zoo/generator/view/MainPanel.fxml"));
      BorderPane o = loader2.load();

      scene.setRoot(o);

      MainPanelController controller = loader2.getController();
      controller.setRandomGenerationService(RandomGenerationService.getInstance());

      primaryStage.show();

      primaryStage.setOnCloseRequest(
          new EventHandler<WindowEvent>() {

            @Override
            public void handle(WindowEvent event) {
              System.out.println("Arrêt des threads");
              Thread[] threads = new Thread[100];

              int n = Thread.enumerate(threads);

              for (int i = 0; i < n; i++) {
                System.out.println(threads[i]);
              }

              // 1. Stop random generation
              RandomGenerationService.getInstance().stop();

              // 2. Stop server thread
              Server.getInstance().stop();

              // 3. Stop client threads
              ClientHandler.stopAll();

              System.out.println("Après l'arrêt des threads");
            }
          });

      Server.getInstance().start();

    } catch (IOException e) {
      e.printStackTrace();
    }
  }
  public void login(String name, String paswd) throws LoginException, IOException {
    System.out.println(name);
    System.out.println(paswd);
    DataAccess da = new DataAccessFacade();
    HashMap<String, User> map = da.readUserMap();
    if (!map.containsKey(name)) {
      errorMessage.setText("*Name not found!");
      throw new LoginException("Name " + name + " not found");
    }
    String passwordFound = map.get(name).getPassword();
    if (!passwordFound.equals(paswd)) {
      errorMessage.setText("*Password not match!");
      throw new LoginException("Passord does not match password on record");
    }
    currentAuth = map.get(name).getAuthorization();
    System.out.println("Successfully login by " + currentAuth.toString());
    if (currentAuth.toString().equals("LIBRARIAN")) {
      Stage libStage = new Stage();
      Parent root;
      try {
        root = FXMLLoader.load(getClass().getResource("../view/LiberianMain.fxml"));
        libStage.setTitle("Librarian - Checkin/Checkout");
        Scene scene = new Scene(root, 1000, 800);
        libStage.setScene(scene);
        libStage.show();
        userName.getScene().getWindow().hide();

      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    if (currentAuth.toString().equals("ADMIN")) {
      Stage libStage = new Stage();
      Parent root;
      try {
        root = FXMLLoader.load(getClass().getResource("../view/AdministratorMain.fxml"));
        libStage.setTitle("Administrator");
        Scene scene = new Scene(root, 1000, 800);
        libStage.setScene(scene);
        libStage.show();
        userName.getScene().getWindow().hide();

      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
 public void goHome() throws IOException {
   Parent page = FXMLLoader.load(getClass().getResource("Portal.fxml"));
   Scene scene = new Scene(page);
   Stage stage = (Stage) homeBtn.getScene().getWindow();
   stage.setScene(scene);
   stage.show();
 }
Example #9
0
 @Override
 public void start(Stage primaryStage) throws Exception {
   Parent root = FXMLLoader.load(getClass().getResource("/fxml/telaLogin.fxml"));
   primaryStage.setTitle("Login");
   primaryStage.setScene(new Scene(root, 465, 223));
   primaryStage.show();
 }
Example #10
0
  @FXML
  private void gameSetup(ActionEvent e) throws NullPointerException {
    try {
      if (e.getSource() == nextButton) {
        numPlayer = Integer.parseInt(numPlayers.getSelectionModel().getSelectedItem().toString());
        // initializing players array
        players = new Player[numPlayer.intValue()];
        String map = mapType.getSelectionModel().getSelectedItem().toString();
        if (Objects.equals(map, "Random")) {
          try {
            gameRoot = FXMLLoader.load(getClass().getResource("UIFiles/MainMap.fxml"));
            //				RandMap.setImages();
          } catch (Exception e1) {
            e1.printStackTrace();
          }
        }
        level =
            difficulty
                .getSelectionModel()
                .getSelectedItem()
                .toString(); // "Beginner", "Standard", or "Tournament"
        Launcher.primaryStage.setScene(
            Launcher.nextScene); // Show player config screen for player 1
        Launcher.primaryStage.setTitle("Player 1 Configuration");
        count = 1;

      } else if (e.getSource() == cancelButton) {
        Launcher.primaryStage.close();
      }
    } catch (NullPointerException error) {
      Launcher.primaryStage.setScene(Launcher.errorMessage);
    }
  }
  /**
   * 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();
    }
  }
  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();
    }
  }
Example #13
0
  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;
    }
  }
 //    @Override
 //    public void setScreenParent(ScreensController screenParent) {
 //        controller = screenParent;
 //    }
 @FXML
 public void buttonClick(ActionEvent event) throws IOException {
   // controller.loadScreen(Main.createAdminFile);
   if (checkInfo()) {
     Alert emptyInfo = new Alert(Alert.AlertType.ERROR);
     emptyInfo.setTitle("Error");
     emptyInfo.setHeaderText("Please make sure to correctly fill out the following: \n");
     emptyInfo.setContentText(errorStr);
     emptyInfo.showAndWait();
   } else {
     groupDir = Paths.get("").toAbsolutePath().toString() + "\\" + groupUsernameField.getText();
     if (!Files.exists(Paths.get(groupDir))) {
       saveData();
       Stage stage = (Stage) groupNext.getScene().getWindow();
       Parent root = FXMLLoader.load(getClass().getResource(Main.createAdminFile));
       Scene scene = new Scene(root);
       stage.setScene(scene);
       stage.show();
     } else {
       Alert emptyInfo = new Alert(Alert.AlertType.ERROR);
       emptyInfo.setTitle("Error: Company exists");
       emptyInfo.setHeaderText(null);
       emptyInfo.setContentText(
           "Company by that name already exists in the system. Please enter a new company name.");
       emptyInfo.showAndWait();
     }
     // Files.delete(file.toPath());
   }
 }
  /**
   * This method is called when the splash screen has finished initializing the application. The
   * initialized resources are in a ServiceLocator singleton. Our task is to now create the
   * application MVC components, to hide the splash screen, and to display the application GUI.
   *
   * <p>Multitasking note: This method is called from an event-handler in the Splash_Controller,
   * which means that it is on the JavaFX Application Thread, which means that it is allowed to work
   * with GUI components. http://docs.oracle.com/javafx/2/threads/jfxpub-threads.htm
   */
  public void startApp() {
    // Stage appStage = new Stage();
    serverStage = new Stage();
    // Resources are now initialized
    ServiceLocator sl = ServiceLocator.getServiceLocator();
    Translator t = sl.getTranslator();
    System.out.println("BLABLA");
    try {
      final URL fxmlURL =
          getClass().getResource("/Server/Server.fxml"); // FXML-File from the ClientLogin-Window
      final FXMLLoader fxmlLoader = new FXMLLoader(fxmlURL);
      fxmlLoader.setController(new Server_Controller());
      final Parent root = fxmlLoader.load();
      Scene scene = new Scene(root, 650, 450);
      //			scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
      serverStage.setScene(scene);
      serverStage.setTitle(t.getString("program.name.windowName"));
      serverStage.show();
      String zwischenstatus = fxmlURL.toString();
      System.out.println("Application FXML Loader Pfad ist: " + zwischenstatus);
    } catch (Exception e) {
      e.printStackTrace();
    }

    // Close the splash screen, and set the reference to null, so that all
    // Splash_XXX objects can be garbage collected
    splashView.stop();
    splashView = null;

    //        view.start();
  }
Example #16
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;
    }
  }
Example #17
0
 @Override
 public void start(Stage primaryStage) throws Exception {
   Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
   primaryStage.setTitle("ToDo Desktop");
   primaryStage.setScene(new Scene(root, 800, 600));
   primaryStage.show();
 }
 public void goReserveTrain() throws IOException {
   Parent page = FXMLLoader.load(getClass().getResource("BookingReservTrain.fxml"));
   Scene scene = new Scene(page);
   Stage stage = (Stage) homeBtn.getScene().getWindow();
   stage.setScene(scene);
   stage.show();
 }
 public void reserveEditNotConfirm() throws IOException {
   Parent page = FXMLLoader.load(getClass().getResource("BookingEdit.fxml"));
   Scene scene = new Scene(page);
   Stage stage = (Stage) notConfirmReserve.getScene().getWindow();
   stage.setScene(scene);
   stage.show();
 }
  @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();
    }
  }
Example #21
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;
    }
  }
Example #22
0
 /**
  * Start up the application interface.
  *
  * @param primaryStage Primary stage of the interface.
  * @throws Exception Failed to load resources or open interface.
  */
 @Override
 public void start(Stage primaryStage) throws Exception {
   Parent root = FXMLLoader.load(getClass().getResource("Main.fxml"));
   primaryStage.setTitle("Timed Shutdown");
   primaryStage.setScene(new Scene(root, 360, 170));
   primaryStage.show();
 }
Example #23
0
 @Override
 public void start(Stage primaryStage) throws Exception {
   Parent root = FXMLLoader.load(getClass().getResource("/sample/view/filter.fxml"));
   primaryStage.setTitle("filter");
   primaryStage.setScene(new Scene(root));
   primaryStage.show();
 }
Example #24
0
 protected void initUI(
     String stageTitle,
     String gui,
     double stageWidth,
     double stageHeight,
     double maxStageWidth,
     double maxStageHeight,
     double stageX,
     double stageY,
     boolean resizable,
     Modality modality,
     Stage stage,
     Window owner)
     throws IOException {
   FXMLLoader loader = new FXMLLoader(getClass().getResource(gui));
   loader.setController(this);
   this.scene = new Scene(loader.load(), stageWidth, stageHeight);
   this.stage = (null != stage) ? stage : new Stage();
   this.stage.setMaxWidth(maxStageWidth);
   this.stage.setMaxHeight(maxStageHeight);
   this.stage.setTitle(stageTitle);
   this.stage.setScene(this.scene);
   this.stage.setX(stageX);
   this.stage.setY(stageY);
   this.stage.resizableProperty().setValue(resizable);
   if (null != modality) this.stage.initModality(modality);
   if (null != owner) this.stage.initOwner(owner);
 }
  public MainStageController(Controller controller) {
    this.controller = controller;
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("MainStage.fxml"));
    fxmlLoader.setController(this);
    try {
      root = fxmlLoader.load();
    } catch (IOException e) {
      e.printStackTrace();
    }

    currentUserMenuButton.setText(controller.getCurrentUser().getName());
    collectAccountTable();
    accountsTable
        .getSelectionModel()
        .selectedItemProperty()
        .addListener(
            new ChangeListener<Account>() {
              @Override
              public void changed(
                  ObservableValue<? extends Account> observable,
                  Account oldValue,
                  Account newValue) {
                controller.setCurrentAccount(accountsTable.getSelectionModel().getSelectedItem());
                showRecords(controller.getCurrentAccount());
                showBalanceLabel();
              }
            });

    showRecords(controller.getCurrentAccount());
    showBalanceLabel();
  }
Example #26
0
  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();
    }
  }
Example #27
0
 @Override
 public void start(Stage primaryStage) throws Exception {
   Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
   primaryStage.setTitle(getUserNameFull() + "!!!");
   primaryStage.setScene(new Scene(root, 300, 275));
   primaryStage.show();
 }
  /** 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;
    }
  }
  @FXML
  public void ProductDetails() {

    try {
      URL location = getClass().getResource("proTableview.fxml");

      FXMLLoader fxmlLoader = new FXMLLoader();
      fxmlLoader.setLocation(location);
      fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());

      Parent root1 = (Parent) fxmlLoader.load(location.openStream());

      proTableViewController ctr = (proTableViewController) fxmlLoader.getController();

      Scene scene = new Scene(root1);

      RuwanBook.getStage().setTitle("Product Details");
      RuwanBook.getStage().setScene(scene);

      RuwanBook.getStage().show();

    } catch (IOException ex) {
      Logger.getLogger(SupplierController.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
  // called at start of application
  @Override
  public void start(Stage primaryStage) {

    this.primaryStage = primaryStage;

    this.primaryStage.setTitle("TextProApp");

    try {
      // Load root layout from fxml
      FXMLLoader loader = new FXMLLoader(MainApp.class.getResource("view/RootLayout.fxml"));
      rootLayout = (BorderPane) loader.load();
      Scene scene = new Scene(rootLayout);
      primaryStage.setScene(scene);

      // min height and width calculated from components in TextAppLayout
      primaryStage.setMinHeight(430);
      primaryStage.setMinWidth(334);
      primaryStage.show();

    } catch (Exception e) {
      e.printStackTrace();
    }

    showTextProApp();
  }