private void createTextField() {
   textField = new TextField(getString());
   textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
   textField.setOnKeyPressed(
       new EventHandler<KeyEvent>() {
         @Override
         public void handle(KeyEvent t) {
           if (t.getCode() == KeyCode.ENTER) {
             commitEdit(textField.getText());
           } else if (t.getCode() == KeyCode.ESCAPE) {
             cancelEdit();
           } else if (t.getCode() == KeyCode.TAB) {
             commitEdit(textField.getText());
             TableColumn nextColumn = getNextColumn(!t.isShiftDown());
             if (nextColumn != null) {
               getTableView().edit(getTableRow().getIndex(), nextColumn);
             }
           }
         }
       });
   textField
       .focusedProperty()
       .addListener(
           new ChangeListener<Boolean>() {
             @Override
             public void changed(
                 ObservableValue<? extends Boolean> observable,
                 Boolean oldValue,
                 Boolean newValue) {
               if (!newValue && textField != null) {
                 commitEdit(textField.getText());
               }
             }
           });
 }
Example #2
0
  private void createTextField() {

    textField = new TextField(getString());
    textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);

    // TODO new added
    textField
        .focusedProperty()
        .addListener(
            new ChangeListener<Boolean>() {

              @Override
              public void changed(
                  ObservableValue<? extends Boolean> arg0, Boolean arg1, Boolean arg2) {
                if (!arg2) {
                  commitEdit(textField.getText());
                }
              }
            });

    textField.setOnKeyPressed(
        new EventHandler<KeyEvent>() {
          @Override
          public void handle(KeyEvent t) {
            if (t.getCode() == KeyCode.ENTER) {
              commitEdit(textField.getText());
            } else if (t.getCode() == KeyCode.ESCAPE) {
              cancelEdit();
            }
          }
        });
  }
Example #3
0
  public ViewChat() {

    // chatWindow properties
    chatWindow.setMinHeight(240);
    chatWindow.setEditable(false);

    // send group
    chatBox.setMinWidth(480);
    sendButton.setMinWidth(100);
    sendButton.setOnAction(this::sendButtonAction);
    chatBox.setOnKeyPressed(this::chatBoxKey);

    HBox sendGroup = new HBox(chatBox, sendButton);
    sendGroup.setPadding(new javafx.geometry.Insets(10, 10, 10, 10));

    // add all controllers to view
    this.setMinWidth(600);
    this.getChildren().add(chatWindow);
    this.getChildren().add(sendGroup);

    // start chat client
    try {
      chatClient = new ChatClient();
      chatClient.initialize(getUserName(), chatWindow);
    } catch (RemoteException e) {
      e.printStackTrace();
    }

    // chatBox focus
    Platform.runLater(chatBox::requestFocus);
  }
 public void setDialogStage(Stage dialogStage, PromptData param) {
   this.dialogStage = dialogStage;
   switch (Main.programTheme) {
     case Main.THEMELIGHT:
       dialogStage
           .getScene()
           .getStylesheets()
           .add(getClass().getResource("/css/" + Main.FILENAMETHEMELIGHT).toExternalForm());
       break;
     case Main.THEMEDARK:
       dialogStage
           .getScene()
           .getStylesheets()
           .add(getClass().getResource("/css/" + Main.FILENAMETHEMEDARK).toExternalForm());
       break;
     case Main.THEMENANAHIRA:
       dialogStage
           .getScene()
           .getStylesheets()
           .add(getClass().getResource("/css/" + Main.FILENAMETHEMENANAHIRA).toExternalForm());
       break;
     default:
       dialogStage
           .getScene()
           .getStylesheets()
           .add(getClass().getResource("/css/" + Main.FILENAMETHEMELIGHT).toExternalForm());
       break;
   }
   promptLabel.setText(param.getMessage());
   promptTextField.setText(param.getDefaultValue());
   promptTextField.setOnKeyPressed(
       event -> {
         if (event.getCode().equals(KeyCode.ENTER)) handleOk();
       });
 }
Example #5
0
 /** Creates the editor */
 private void createTextField() {
   textField = new TextField(getString());
   textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
   textField.setAlignment(getAlignment());
   textField.setOnKeyPressed(
       new EventHandler<KeyEvent>() {
         @Override
         public void handle(KeyEvent t) {
           if (t.getCode() == KeyCode.ENTER) {
             commitIfValid(textField.getText());
           } else if (t.getCode() == KeyCode.ESCAPE) {
             cancelEdit();
           }
         }
       });
 }
  private void addLogin(final Stage primaryStage) {
    grid = new GridPane();
    btn = new Button();
    scenetitle = new Text("Welcome");
    userName = new Label("Name:");
    userTextField = new TextField();
    userTextField.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent event) {
            if (event.getCode().equals(KeyCode.ENTER)) {
              login(primaryStage);
            }
          }
        });

    btn.setText("Sign in");
    btn.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent event) {
            login(primaryStage);
          }
        });

    scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));

    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    grid.add(scenetitle, 0, 0);
    grid.add(userName, 0, 1);
    grid.add(userTextField, 1, 1);
    grid.add(btn, 0, 2);

    Scene scene = new Scene(grid, 300, 275);
    primaryStage.setTitle("Chat Login");
    primaryStage.setScene(scene);
    primaryStage.show();
  }
  private void createTextField() {
    textField = new TextField(getString());
    textField.setMinWidth(this.getWidth() - this.getGraphicTextGap() * 2);
    textField.setOnKeyPressed(
        new EventHandler<KeyEvent>() {
          @Override
          public void handle(KeyEvent t) {
            if (t.getCode() == KeyCode.ENTER) {
              commitHelper(false);
            } else if (t.getCode() == KeyCode.ESCAPE) {
              cancelEdit();
            } else if (t.getCode() == KeyCode.TAB) {
              commitHelper(false);

              getTableView()
                  .edit(
                      getTableView().getSelectionModel().getSelectedIndex() + 1, getTableColumn());
            }
          }
        });
    textField
        .focusedProperty()
        .addListener(
            new ChangeListener<Boolean>() {
              @Override
              public void changed(
                  ObservableValue<? extends Boolean> observable,
                  Boolean oldValue,
                  Boolean newValue) {
                // This focus listener fires at the end of cell editing when focus is lost
                // and when enter is pressed (because that causes the text field to lose focus).
                // The problem is that if enter is pressed then cancelEdit is called before this
                // listener runs and therefore the text field has been cleaned up. If the
                // text field is null we don't commit the edit. This has the useful side effect
                // of stopping the double commit.
                if (!newValue && textField != null) {
                  commitHelper(true);
                }
              }
            });
  }
 public NameDialog(final Stage stg, Maze maze) {
   width = 350;
   height = 80;
   this.maze = maze;
   stage = new Stage();
   stage.initModality(Modality.APPLICATION_MODAL);
   stage.initOwner(stg);
   stage.setTitle("Name:Press Enter Confirmed");
   Group root = new Group();
   AnchorPane anchorPane = new AnchorPane();
   okbtn = new Button("确定");
   field = new TextField();
   field.setFont(new Font(30));
   field.setPrefWidth(width);
   field.setPrefHeight(height);
   property.set(false);
   MyEvent myEvent = new MyEvent();
   field.setOnKeyPressed(
       new EventHandler<KeyEvent>() {
         @Override
         public void handle(KeyEvent event) {
           if (event.getCode() == KeyCode.ENTER) {
             maze.handleEvent(field.getText());
             stage.close();
           }
         }
       });
   okbtn.setOnMouseClicked(myEvent);
   Scene scene = new Scene(root, width, height + 20);
   anchorPane.getChildren().add(field);
   okbtn.setLayoutX(0);
   okbtn.setLayoutY(height);
   anchorPane.getChildren().add(okbtn);
   root.getChildren().add(anchorPane);
   stage.setScene(scene);
   stage.show();
 }
Example #9
0
  @Override
  public void initialize(URL url, ResourceBundle resourceBundle) {
    viewModel.queryProperty().bind(searchTextField.textProperty());
    searchResultsListView.setItems(viewModel.getResults());

    searchTextField.setOnKeyPressed(
        event -> {
          if (event.getCode() == KeyCode.UP || event.getCode() == KeyCode.DOWN) {
            searchResultsListView.requestFocus();
            searchResultsListView.fireEvent(event);
          } else if (event.getCode() == KeyCode.ESCAPE) {
            event.consume();
            viewModel.closeSearch();
          } else if (event.getCode() == KeyCode.ENTER) {
            if (viewModel.queryProperty().get().equals("times new roman")) {
              ObservableList<String> classes =
                  MainController.getPrimaryStage().getScene().getRoot().getStyleClass();
              if (classes.contains("gag")) {
                classes.remove("gag");
              } else {
                classes.add("gag");
              }
            }
            event.consume();
            viewModel.buttonAction(searchResultsListView.getSelectionModel().getSelectedItem());
          }
        });

    searchTextField.setOnKeyReleased(
        event -> {
          viewModel.getSearchCommand().execute();
          searchResultsListView.getSelectionModel().selectFirst();
        });

    searchResultsListView.setOnKeyPressed(
        event -> {
          if (event.getCode() == KeyCode.ESCAPE) {
            event.consume();
            viewModel.closeSearch();
          } else if (event.getCode() == KeyCode.ENTER || event.getCode() == KeyCode.SPACE) {
            event.consume();
            viewModel.buttonAction(searchResultsListView.getSelectionModel().getSelectedItem());
          } else if (!(event.getCode() == KeyCode.UP || event.getCode() == KeyCode.DOWN)) {
            searchTextField.requestFocus();
            searchTextField.positionCaret(searchTextField.getLength());
            searchTextField.fireEvent(event);
          }
        });

    searchResultsListView.setCellFactory(
        param ->
            new ListCell<SearchResult>() {
              @Override
              protected void updateItem(SearchResult item, boolean empty) {
                setPadding(new Insets(0));
                super.updateItem(item, empty);
                if (!empty) {
                  setGraphic(viewModel.generateSearchResultRow(item));
                } else {
                  setGraphic(null);
                  setText("");
                }
              }
            });

    searchResultsListView
        .visibleProperty()
        .bind(Bindings.size(viewModel.getResults()).greaterThan(0));
    searchResultsListView
        .managedProperty()
        .bind(Bindings.size(viewModel.getResults()).greaterThan(0));

    viewModel
        .getResults()
        .addListener(
            (ListChangeListener<? super SearchResult>)
                c -> {
                  if (viewModel.getResults().size() > 0) {
                    searchResultsListView.setPrefHeight(
                        Integer.min(MAX_RESULTS_BEFORE_SCROLLBAR, viewModel.getResults().size())
                                * 30
                            + 10);
                    searchResultsListView
                        .getScene()
                        .getWindow()
                        .setHeight(
                            Integer.min(MAX_RESULTS_BEFORE_SCROLLBAR, viewModel.getResults().size())
                                    * 30
                                + 63);
                  } else {
                    searchResultsListView.getScene().getWindow().setHeight(61);
                  }
                });
  }
  public newFenetreParametre(Stage primaryStage) {
    this.initModality(Modality.WINDOW_MODAL);
    this.initOwner(primaryStage);

    String fichier = "config.ini";
    final ArrayList<String> listParam = new ArrayList<String>();

    try {
      InputStream ips = new FileInputStream(fichier);
      InputStreamReader ipsr = new InputStreamReader(ips);
      BufferedReader br = new BufferedReader(ipsr);
      String ligne;
      while ((ligne = br.readLine()) != null) {
        System.out.println(ligne);
        listParam.add(ligne);
      }
      br.close();
    } catch (Exception e) {
      System.out.println(e.toString());
    }

    tfParamBleu.setText(listParam.get(0).substring(listParam.get(0).lastIndexOf(" ") + 1));
    tfParamRouge.setText(listParam.get(1).substring(listParam.get(1).lastIndexOf(" ") + 1));
    tfParamBleuEnnemi.setText(listParam.get(2).substring(listParam.get(2).lastIndexOf(" ") + 1));
    tfParamRougeEnnemi.setText(listParam.get(3).substring(listParam.get(3).lastIndexOf(" ") + 1));
    tfParamDragon.setText(listParam.get(4).substring(listParam.get(4).lastIndexOf(" ") + 1));
    tfParamNashor.setText(listParam.get(5).substring(listParam.get(5).lastIndexOf(" ") + 1));
    tfParamAnnulateur.setText(listParam.get(6).substring(listParam.get(6).lastIndexOf(" ") + 1));
    checkboxSounds.setSelected(
        listParam.get(7).substring(listParam.get(7).lastIndexOf(" ") + 1).contains("YES"));
    checkboxOverlay.setSelected(
        listParam.get(8).substring(listParam.get(8).lastIndexOf(" ") + 1).contains("YES"));

    tfParamBleu.setEditable(false);
    tfParamBleu.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            System.out.println(e.getCode());
            tfParamBleu.setText(e.getCode().toString());
          }
        });
    tfParamRouge.setEditable(false);
    tfParamRouge.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            System.out.println(e.getCode());
            tfParamRouge.setText(e.getCode().toString());
          }
        });
    tfParamBleuEnnemi.setEditable(false);
    tfParamBleuEnnemi.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            System.out.println(e.getCode());
            tfParamBleuEnnemi.setText(e.getCode().toString());
          }
        });
    tfParamRougeEnnemi.setEditable(false);
    tfParamRougeEnnemi.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            System.out.println(e.getCode());
            tfParamRougeEnnemi.setText(e.getCode().toString());
          }
        });
    tfParamDragon.setEditable(false);
    tfParamDragon.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            if (!e.getCode().isKeypadKey()) {
              System.out.println(e.getCode());
              tfParamDragon.setText(e.getCode().toString());
            }
          }
        });
    tfParamNashor.setEditable(false);
    tfParamNashor.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {

            tfParamNashor.setText(e.getCode().toString());
          }
        });
    tfParamAnnulateur.setEditable(false);
    tfParamAnnulateur.setOnKeyPressed(
        new EventHandler<KeyEvent>() {

          @Override
          public void handle(KeyEvent e) {
            if (e.isShiftDown()) {
              tfParamAnnulateur.setText("Maj");
            } else {
              tfParamAnnulateur.setText(e.getCode().toString());
            }
          }
        });

    HBox hbEnrAnn = new HBox(5);
    Button boutonEnregistrer = new Button("Enregistrer");
    boutonEnregistrer.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent e) {
            try {
              String fichier = "config.ini";
              FileWriter fw = new FileWriter(fichier);
              BufferedWriter bw = new BufferedWriter(fw);
              PrintWriter fichierSortie = new PrintWriter(bw);

              fichierSortie.println("Bleu : " + tfParamBleu.getText());
              fichierSortie.println("Rouge : " + tfParamRouge.getText());
              fichierSortie.println("BleuEnnemi : " + tfParamBleuEnnemi.getText());
              fichierSortie.println("RougeEnnemi : " + tfParamRougeEnnemi.getText());
              fichierSortie.println("Dragon : " + tfParamDragon.getText());
              fichierSortie.println("Nashor : " + tfParamNashor.getText());
              fichierSortie.println("Annulateur : " + tfParamAnnulateur.getText());
              if (checkboxSounds.isSelected()) {
                fichierSortie.println("Sounds : YES");
              } else {
                fichierSortie.println("Sounds : NO");
              }
              if (checkboxOverlay.isSelected()) {
                fichierSortie.println("Overlay : YES");
              } else {
                fichierSortie.println("Overlay : NO");
              }

              fichierSortie.close();
              System.out.println("Le fichier " + fichier + " a été créé!");
            } catch (Exception e1) {
              System.out.println(e1.toString());
            }
            AppCore.inputBleu = tfParamBleu.getText();
            AppCore.inputRouge = tfParamRouge.getText();
            AppCore.inputBleuEnnemi = tfParamBleuEnnemi.getText();
            AppCore.inputRougeEnnemi = tfParamRougeEnnemi.getText();
            AppCore.inputDragon = tfParamDragon.getText();
            AppCore.inputNashor = tfParamNashor.getText();
            AppCore.inputAnnulateur = tfParamAnnulateur.getText();
            if (checkboxSounds.isSelected()) {
              AppCore.stateSounds = true;
            } else {
              AppCore.stateSounds = false;
            }
            if (checkboxOverlay.isSelected()) {
              AppCore.stateOverlay = true;
            } else {
              AppCore.stateOverlay = false;
            }
            close();
          }
        });
    Button boutonAnnuler = new Button("Annuler");
    boutonAnnuler.setOnAction(
        new EventHandler<ActionEvent>() {

          @Override
          public void handle(ActionEvent e0) {
            close();
          }
        });

    GridPane grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    grid.add(labelParamBleu, 0, 0);
    grid.add(labelParamRouge, 0, 1);
    grid.add(labelParamBleuEnnemi, 0, 2);
    grid.add(labelParamRougeEnnemi, 0, 3);
    grid.add(labelParamDragon, 0, 4);
    grid.add(labelParamNashor, 0, 5);
    grid.add(labelParamAnnulateur, 0, 6);
    grid.add(labelParamSounds, 0, 7);
    grid.add(labelParamOverlay, 0, 8);

    grid.add(tfParamBleu, 1, 0);
    grid.add(tfParamRouge, 1, 1);
    grid.add(tfParamBleuEnnemi, 1, 2);
    grid.add(tfParamRougeEnnemi, 1, 3);
    grid.add(tfParamDragon, 1, 4);
    grid.add(tfParamNashor, 1, 5);
    grid.add(tfParamAnnulateur, 1, 6);
    grid.add(checkboxSounds, 1, 7);
    grid.add(checkboxOverlay, 1, 8);

    hbEnrAnn.getChildren().add(boutonAnnuler);
    hbEnrAnn.getChildren().add(boutonEnregistrer);
    grid.add(hbEnrAnn, 1, 9);

    setOnHiding(
        new EventHandler<WindowEvent>() {

          @Override
          public void handle(WindowEvent arg0) {}
        });

    this.setScene(new Scene(grid, 315, 315));
    setResizable(false);
    this.show();
  }
Example #11
0
  /**
   * The opening class. When the launch method is run, the code in here begins to execute. All code
   *
   * @param primaryStage The intial stage opened on run
   * @throws Exception
   */
  @SuppressWarnings("unchecked")
  public void start(Stage primaryStage) throws Exception {
    primaryStage.setMaximized(true);
    primaryStage.setTitle("Equipment Manager");
    Button executive = new Button("Executive Options");
    TextField search = new TextField();
    search.setPromptText("Search");
    TableView<Item> table;

    // create filenames
    String fileName = System.getProperty("user.home") + "/item.csv";
    String passFileName = System.getProperty("user.home") + "/notoflookinghere.csv";
    String IDFileName = System.getProperty("user.home") + "/memberlist.csv";
    String logFileName = System.getProperty("user.home") + "/Log.csv";
    File x = new File(fileName);
    // if no file exists with given names, create default files
    if (!x.exists()) {
      csvFileWriter write = new csvFileWriter();
      write.writeCsvFile(logFileName);
      write.writeCsvFile(fileName);
      write.writeCsvFile(IDFileName);
      ArrayList<Item> list = new ArrayList<>();
      list.add(new Item(1000, "password", true, "none", false));
      write.enterData(list);
      write.writeCsvFile(passFileName);
    } else {
      System.out.println("Files Read");
    }

    manage.searchFor(fileName, search.getText());

    table = new TableView<>();
    table.setItems(UIManager.getItems(fileName, search.getText()));
    table.setMaxWidth(675);
    table
        .getColumns()
        .addAll(
            UIManager.referenceColumn(),
            UIManager.nameColumn(),
            UIManager.availableColumn(),
            UIManager.IDColumn(),
            UIManager.permColumn());

    Button checkout = new Button("Checkout");
    checkout.setOnAction(
        e -> {
          Checking.checkOut(fileName, IDFileName, passFileName);
          table.setItems(UIManager.getItems(fileName, search.getText()));
        });

    Button checkIn = new Button("Checkin");
    checkIn.setOnAction(
        e -> {
          Checking.checkIn(fileName);
          table.setItems(UIManager.getItems(fileName, search.getText()));
        });

    search.setOnKeyPressed(e -> table.setItems(UIManager.getItems(fileName, search.getText())));

    // This creates and sets up all the menu bars on the top of the page
    MenuBar menuBar = new MenuBar();

    // Menu Tabs
    Menu help = new Menu("_Help");
    Menu exec = new Menu("_Executive Settings");
    menuBar.getMenus().addAll(help, exec);

    // Menu Items
    MenuItem code = new MenuItem("View Code");
    MenuItem report = new MenuItem("Report a Bug");
    MenuItem openOptions = new MenuItem("Open Executive Options");
    help.getItems().addAll(code, report);
    exec.getItems().addAll(openOptions);

    // Menu External Links
    URI codeLink = new URI("https://github.com/NHSTechTeam/Equipment-System");
    URI reportLink = new URI("https://github.com/NHSTechTeam/Equipment-System/issues");

    // Menu Actions
    code.setOnAction(e -> UIManager.openWebpage(codeLink));
    report.setOnAction(e -> UIManager.openWebpage(reportLink));
    openOptions.setOnAction(
        e -> {
          try {
            ExecutiveMain.executive(fileName, passFileName, logFileName, IDFileName);
          } catch (URISyntaxException e1) {
            e1.printStackTrace();
          }
        });

    HBox menu = new HBox();
    menu.setPadding(new Insets(10, 10, 10, 10));
    menu.setSpacing(10);
    menu.setAlignment(Pos.CENTER);
    menu.getChildren().addAll(checkout, checkIn);

    executive.setOnAction(
        e -> {
          try {
            ExecutiveMain.executive(fileName, passFileName, logFileName, IDFileName);
          } catch (URISyntaxException e1) {
            e1.printStackTrace();
          }
        });

    BorderPane borderLayout = new BorderPane();
    VBox layout = new VBox(10);
    borderLayout.setTop(menuBar);
    borderLayout.setCenter(layout);
    layout.getChildren().addAll(search, table, menu, executive);
    layout.setAlignment(Pos.CENTER);
    Scene scene = new Scene(borderLayout, 300, 250);
    scene.getStylesheets().add("style.css");
    primaryStage.getIcons().add(new Image("images/icon.png"));
    primaryStage.setScene(scene);
    primaryStage.show();
  }
Example #12
0
  public void buildForm() {
    try {
      URL location = getClass().getResource("/com/webfront/app/fxml/LedgerEntryForm.fxml");
      ResourceBundle resources = ResourceBundle.getBundle("com.webfront.app.bank");
      FXMLLoader loader = new FXMLLoader(location, resources);

      btnOk.setDefaultButton(true);
      btnCancel.setCancelButton(true);

      stage = new Stage();
      scene = new Scene(this);
      stage.setScene(scene);
      stage.setTitle("Item Detail");

      loader.setRoot(this);
      loader.setController(this);
      loader.load();

      ObservableList<Category> cList = view.getCategoryManager().getCategories();

      ObservableList<Account> accountList =
          javafx.collections.FXCollections.observableArrayList(Bank.accountList);
      accountList
          .stream()
          .forEach(
              (acct) -> {
                accountNum.getItems().add(acct.getId());
              });

      for (Category c : cList) {
        // Category parent = c.getParent();
        Integer parent = c.getParent();
        categoryMap.put(c.getDescription(), c);
        if (parent == 0) {
          primaryCat.getItems().add(c.getDescription());
        } else if (oldItem != null) {
          if (oldItem.getPrimaryCat() != null) {
            if (parent == oldItem.getPrimaryCat().getId()) {
              subCat.getItems().add(c.getDescription());
            }
          }
        }
      }

      if (oldItem != null) {
        if (oldItem.getSubCat() != null) {
          Category c = oldItem.getSubCat();
          if (c != null) {
            String desc = c.getDescription();
            if (!subCat.getItems().contains(desc)) {
              subCat.getItems().add(desc);
            }
            subCat.setValue(c.getDescription());
          }
        }
      }

      primaryCat
          .getSelectionModel()
          .selectedItemProperty()
          .addListener(
              new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                  String newCat = newValue.toString();
                  if (categoryMap.containsKey(newCat)) {
                    if (oldItem.getId() != null) {
                      Category c = categoryMap.get(newCat);
                      String sqlStmt =
                          "SELECT * FROM categories WHERE parent = " + Integer.toString(c.getId());
                      sqlStmt += " order by description";
                      ObservableList<Category> subCatList =
                          view.getCategoryManager().getCategories(sqlStmt);
                      subCat.getItems().clear();
                      subCatMap.clear();
                      for (Category cat2 : subCatList) {
                        subCatMap.put(cat2.getDescription(), cat2);
                      }
                      subCat.getItems().addAll(subCatMap.keySet());
                      if (oldItem.getPrimaryCat() == null) {
                        oldItem.setPrimaryCat(c);
                        btnOk.setDisable(false);
                      }
                      if (!oldItem.getPrimaryCat().getDescription().equals(primaryCat.getValue())) {
                        oldItem.setPrimaryCat(c);
                        btnOk.setDisable(false);
                      }
                    }
                  }
                }
              });

      subCat
          .getSelectionModel()
          .selectedItemProperty()
          .addListener(
              new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                  if (newValue != null) {
                    String newCat = newValue.toString();
                    if (subCatMap.containsKey(newCat)) {
                      if (oldItem != null) {
                        oldItem.setSubCat(subCatMap.get(newCat));
                        btnOk.setDisable(false);
                      }
                    }
                  }
                }
              });

      transDescription.setOnKeyPressed(
          new EventHandler<KeyEvent>() {
            @Override
            public void handle(KeyEvent event) {
              if (!transDescription.getText().equals(oldItem.getTransDesc())) {
                oldItem.setTransDesc(transDescription.getText());
                btnOk.setDisable(false);
              }
            }
          });

      transDescription
          .textProperty()
          .addListener(
              new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                  if (!oldValue.equals(newValue)) {
                    btnOk.setDisable(false);
                  }
                }
              });

      checkNum.setOnKeyPressed(
          new EventHandler<KeyEvent>() {
            @Override
            public void handle(KeyEvent event) {
              if (event.getCode() == KeyCode.TAB) {
                if (!checkNum.getText().equals(oldItem.getCheckNum())) {
                  oldItem.setCheckNum(checkNum.getText());
                  btnOk.setDisable(false);
                }
              }
            }
          });

      transAmt
          .textProperty()
          .addListener(
              new ChangeListener() {
                @Override
                public void changed(ObservableValue observable, Object oldValue, Object newValue) {
                  if (!oldValue.equals(newValue)) {
                    btnOk.setDisable(false);
                  }
                }
              });

      distView.setPrefSize(857.0, 175.0);
      paymentDetail.setPrefSize(857.0, 175.0);
      distView.getChildren().add(paymentDetail);
      stage.show();

    } catch (IOException ex) {
      Logger.getLogger(LedgerForm.class.getName()).log(Level.SEVERE, null, ex);
    }
  }
Example #13
0
File: Main.java Project: 8CAKE/ALE
  @Override
  public void start(Stage primaryStage) throws Exception {

    try {
      screenSize = Screen.getPrimary().getVisualBounds();
      width = screenSize.getWidth(); // gd.getDisplayMode().getWidth();
      height = screenSize.getHeight(); // gd.getDisplayMode().getHeight();
    } catch (Exception excep) {
      System.out.println("<----- Exception in  Get Screen Size ----->");
      excep.printStackTrace();
      System.out.println("<---------->\n");
    }

    try {
      dbCon =
          DriverManager.getConnection(
              "jdbc:mysql://192.168.1.6:3306/ale", "Root", "oqu#$XQgHFzDj@1MGg1G8");
      estCon = true;
    } catch (SQLException sqlExcep) {
      System.out.println("<----- SQL Exception in Establishing Database Connection ----->");
      sqlExcep.printStackTrace();
      System.out.println("<---------->\n");
    }

    xmlParser.generateUserInfo();
    superUser = xmlParser.getSuperUser();

    // ----------------------------------------------------------------------------------------------------> Top Panel Start

    closeBtn = new Button("");
    closeBtn.getStyleClass().add("systemBtn");
    closeBtn.setOnAction(
        e -> {
          systemClose();
        });

    minimizeBtn = new Button("");
    minimizeBtn.getStyleClass().add("systemBtn");
    minimizeBtn.setOnAction(
        e -> {
          primaryStage.setIconified(true);
        });

    miscContainer = new HBox();

    calcBtn = new Button();
    calcBtn.getStyleClass().addAll("calcBtn");
    calcBtn.setOnAction(
        e -> {
          calculator calculator = new calculator();
          scientificCalculator scientificCalculator = new scientificCalculator();
          calculator.start(calculatorName);
        });

    miscContainer.getChildren().add(calcBtn);

    topPanel = new HBox(1);
    topPanel.getStyleClass().add("topPanel");
    topPanel.setPrefWidth(width);
    topPanel.setAlignment(Pos.CENTER_RIGHT);
    topPanel.setPadding(new Insets(0, 0, 0, 0));
    topPanel.getChildren().addAll(miscContainer, minimizeBtn, closeBtn);

    // ------------------------------------------------------------------------------------------------------> Top Panel End

    // ----------------------------------------------------------------------------------------------> Navigation Panel Start

    Line initDivider = new Line();
    initDivider.setStartX(0.0f);
    initDivider.setEndX(205.0f);
    initDivider.setStroke(Color.GRAY);

    // <----- Dashboard ----->
    dashboardToolTip = new Tooltip("Dashboard");

    dashboardBtn = new Button("");
    dashboardBtn.getStyleClass().add("dashboardBtn");
    dashboardBtn.setTooltip(dashboardToolTip);
    dashboardBtn.setOnAction(
        e -> {
          resetBtns();
          rootPane.setCenter(dashBoardBase);
        });

    // <----- Profile ----->
    profileToolTip = new Tooltip("Profile");

    profileBtn = new Button();
    profileBtn.getStyleClass().add("profileBtn");
    profileBtn.setTooltip(profileToolTip);
    profileBtn.setOnAction(
        e -> {
          resetBtns();
          rootPane.setCenter(profilePanel);
        });

    // <----- Courses ----->
    courseToolTip = new Tooltip("Courses");

    coursesBtn = new Button("");
    coursesBtn.getStyleClass().add("coursesBtn");
    coursesBtn.setTooltip(courseToolTip);
    coursesBtn.setOnAction(
        e -> {
          resetBtns();
          rootPane.setCenter(coursesPanel);
          // miscContainer.getChildren().addAll(watchVidBtn);
          coursesPanel.setContent(coursesGridPanel);
        });

    Line mainDivider = new Line();
    mainDivider.setStartX(0.0f);
    mainDivider.setEndX(205.0f);
    mainDivider.setStroke(Color.GRAY);

    // <----- Simulations ----->
    simsToolTip = new Tooltip("Simulations");

    simsBtn = new Button();
    simsBtn.getStyleClass().add("simsBtn");
    simsBtn.setTooltip(simsToolTip);
    simsBtn.setOnAction(
        e -> {
          resetBtns();
          rootPane.setCenter(simsPanel);
          simsPanel.setContent(simsGridPanel);
        });

    // <----- Text Editor ----->
    textEditorToolTip = new Tooltip("Text Editor");

    textEditorBtn = new Button();
    textEditorBtn.getStyleClass().add("textEditorBtn");
    textEditorBtn.setTooltip(textEditorToolTip);
    textEditorBtn.setOnAction(
        e -> {
          resetBtns();
          rootPane.setCenter(textEditorPanel);
          miscContainer.getChildren().addAll(saveDocBtn);
        });

    Line toolsDivider = new Line();
    toolsDivider.setStartX(0.0f);
    toolsDivider.setEndX(205.0f);
    toolsDivider.setStroke(Color.GRAY);

    // <----- Wolfram Alpha ----->
    wolframToolTip = new Tooltip("Wolfram Alpha");

    wolframBtn = new Button();
    wolframBtn.getStyleClass().add("wolframBtn");
    wolframBtn.setTooltip(wolframToolTip);
    wolframBtn.setOnAction(
        e -> {
          resetBtns();
          rootPane.setCenter(wolframPanel);
        });

    // <----- Wikipedia ----->
    wikipediaToolTip = new Tooltip();

    wikipediaBtn = new Button();
    wikipediaBtn.getStyleClass().add("wikipediaBtn");
    wikipediaBtn.setTooltip(wikipediaToolTip);
    wikipediaBtn.setOnAction(
        e -> {
          resetBtns();
          rootPane.setCenter(wikipediaPanel);
        });

    Line sitesDivider = new Line();
    sitesDivider.setStartX(0.0f);
    sitesDivider.setEndX(205.0f);
    sitesDivider.setStroke(Color.GRAY);

    // <----- Settings ----->
    settingsToolTip = new Tooltip("Settings");

    settingsBtn = new Button();
    settingsBtn.getStyleClass().add("settingsBtn");
    settingsBtn.setTooltip(settingsToolTip);
    settingsBtn.setOnAction(
        e -> {
          resetBtns();
          rootPane.setCenter(settingsPanel);
        });

    leftPanel = new VBox(0);
    // leftPanel.setPrefWidth(1);
    leftPanel.getStyleClass().add("leftPane");
    leftPanel
        .getChildren()
        .addAll(
            initDivider,
            dashboardBtn,
            profileBtn,
            coursesBtn,
            mainDivider,
            simsBtn,
            textEditorBtn,
            toolsDivider,
            wolframBtn,
            wikipediaBtn,
            sitesDivider,
            settingsBtn);

    topPanel = new HBox(1);
    topPanel.getStyleClass().add("topPanel");
    topPanel.setPrefWidth(width);
    topPanel.setAlignment(Pos.CENTER_RIGHT);
    topPanel.setPadding(new Insets(0, 0, 0, 0));
    topPanel.getChildren().addAll(miscContainer, minimizeBtn, closeBtn);

    // ------------------------------------------------------------------------------------------------> Navigation Panel End

    // -----------------------------------------------------------------------------------------------> Dashboard Pane Start

    final WebView webVid = new WebView();
    final WebEngine webVidEngine = webVid.getEngine();
    webVid.setPrefHeight(860);
    webVid.setPrefWidth(width - 118);
    webVidEngine.loadContent("");

    final NumberAxis xAxis = new NumberAxis();
    final NumberAxis yAxis = new NumberAxis();
    xAxis.setLabel("Day");
    yAxis.setLabel("Score");
    final LineChart<Number, Number> lineChart = new LineChart<Number, Number>(xAxis, yAxis);

    lineChart.setTitle("Line Chart");
    XYChart.Series<Number, Number> series = new XYChart.Series<Number, Number>();
    series.setName("My Data");

    // populating the series with data
    series.getData().add(new XYChart.Data<Number, Number>(0.25, 36));
    series.getData().add(new XYChart.Data<Number, Number>(1, 23));
    series.getData().add(new XYChart.Data<Number, Number>(2, 114));
    series.getData().add(new XYChart.Data<Number, Number>(3, 15));
    series.getData().add(new XYChart.Data<Number, Number>(4, 124));
    lineChart.getData().add(series);
    lineChart.setPrefWidth(400);
    lineChart.setPrefHeight(300);
    lineChart.setLegendVisible(false);

    chatRoomField = new TextField();
    chatRoomField.getStyleClass().add("textField");
    chatRoomField.setPromptText("Enter Chat Room");
    chatRoomField.setOnKeyPressed(
        new EventHandler<KeyEvent>() {
          @Override
          public void handle(KeyEvent event) {
            if (event.getCode() == KeyCode.ENTER) {
              chatRoom = chatRoomField.getText();
              client.connect(messageArea, messageInputArea, superUser, chatRoom);
            }
          }
        });

    messageArea = new TextArea();
    messageArea.getStyleClass().add("textArea");
    messageArea.setWrapText(true);
    messageArea.setPrefHeight(740);
    messageArea.setEditable(false);

    messageInputArea = new TextArea();
    messageInputArea.getStyleClass().add("textArea");
    messageInputArea.setWrapText(true);
    messageInputArea.setPrefHeight(100);
    messageInputArea.setPromptText("Enter Message");
    messageInputArea.setOnKeyPressed(
        new EventHandler<KeyEvent>() {
          @Override
          public void handle(KeyEvent event) {
            if (event.getCode() == KeyCode.ENTER) {
              client.send(messageArea, messageInputArea, superUser, chatRoom);
              event.consume();
            }
          }
        });

    chatBox = new VBox();
    chatBox.setPrefWidth(250);
    chatBox.setMaxWidth(250);
    chatBox.getStyleClass().add("chatBox");
    chatBox.getChildren().addAll(chatRoomField, messageArea, messageInputArea);

    // client.test(messageArea, messageInputArea);

    dashboardGridPanel = new GridPane();
    dashboardGridPanel.getStyleClass().add("gridPane");
    dashboardGridPanel.setVgap(5);
    dashboardGridPanel.setHgap(5);
    dashboardGridPanel.setGridLinesVisible(false);
    dashboardGridPanel.setPrefWidth(width - 430);
    dashboardGridPanel.setPrefHeight(860);

    dashboardGridPanel.setColumnIndex(lineChart, 0);
    dashboardGridPanel.setRowIndex(lineChart, 0);
    dashboardGridPanel.getChildren().addAll(lineChart);

    dashboardPanel = new ScrollPane();
    dashboardPanel.getStyleClass().add("scrollPane");
    dashboardPanel.setPrefWidth(width - 400);
    dashboardPanel.setPrefHeight(860);
    dashboardPanel.setContent(dashboardGridPanel);

    dashBoardBase = new HBox();
    dashBoardBase.setPrefWidth(width - (leftPanel.getWidth() + chatBox.getWidth()));
    dashBoardBase.setPrefHeight(860);
    dashBoardBase.getChildren().addAll(dashboardPanel, chatBox);

    // -------------------------------------------------------------------------------------------------> Dashboard Pane End

    // -------------------------------------------------------------------------------------------------> Profile Pane Start

    profilePictureBtn = new Button();
    profilePictureBtn.getStyleClass().addAll("profilePictureBtn");

    String profileUserName = xmlParser.getSuperUser();

    String profileEmail = xmlParser.getEmail();
    String profileAge = xmlParser.getAge();
    String profileSchool = xmlParser.getSchool();
    String profileCountry = "";
    String profileCity = "";

    userNameLbl = new Label(profileUserName);
    userNameLbl.getStyleClass().add("profileLbl");
    userNameLbl.setAlignment(Pos.CENTER);

    emailLbl = new Label(profileEmail);
    emailLbl.getStyleClass().add("profileLbl");

    ageLbl = new Label(profileAge);
    ageLbl.getStyleClass().add("profileLbl");

    schoolLbl = new Label(profileSchool);
    schoolLbl.getStyleClass().add("profileLbl");

    profileGridPanel = new GridPane();
    profileGridPanel.getStyleClass().add("gridPane");
    profileGridPanel.setVgap(5);
    profileGridPanel.setHgap(5);
    profileGridPanel.setGridLinesVisible(false);
    profileGridPanel.setPrefWidth(width - 208);
    profileGridPanel.setPrefHeight(860);
    profileGridPanel.setAlignment(Pos.TOP_CENTER);

    profileGridPanel.setRowIndex(profilePictureBtn, 0);
    profileGridPanel.setColumnIndex(profilePictureBtn, 0);
    profileGridPanel.setRowIndex(userNameLbl, 1);
    profileGridPanel.setColumnIndex(userNameLbl, 0);
    profileGridPanel.setRowIndex(emailLbl, 2);
    profileGridPanel.setColumnIndex(emailLbl, 0);
    profileGridPanel.setRowIndex(ageLbl, 3);
    profileGridPanel.setColumnIndex(ageLbl, 0);
    profileGridPanel.setRowIndex(schoolLbl, 4);
    profileGridPanel.setColumnIndex(schoolLbl, 0);
    profileGridPanel
        .getChildren()
        .addAll(profilePictureBtn, userNameLbl, emailLbl, ageLbl, schoolLbl);

    profilePanel = new ScrollPane();
    profilePanel.getStyleClass().add("scrollPane");
    profilePanel.setContent(profileGridPanel);

    // ---------------------------------------------------------------------------------------------------> Profile Pane End

    // -------------------------------------------------------------------------------------------------> Courses Pane Start

    String course = "";

    // Media media = new Media("media.mp4");

    // mediaPlayer = new MediaPlayer(media);
    // mediaPlayer.setAutoPlay(true);

    // mediaView = new MediaView(mediaPlayer);

    watchVidBtn = new Button("Watch Video");
    watchVidBtn.getStyleClass().add("btn");
    watchVidBtn.setOnAction(
        e -> {

          // coursesPanel.setContent(mediaView);
        });

    chemistryBtn = new Button();
    chemistryBtn.getStyleClass().add("chemistryBtn");
    chemistryBtn.setOnAction(
        e -> {
          displayCourse("chemistry");
        });

    physicsBtn = new Button();
    physicsBtn.getStyleClass().add("physicsBtn");
    physicsBtn.setOnAction(
        e -> {
          displayCourse("physics");
        });

    mathsBtn = new Button();
    mathsBtn.getStyleClass().add("mathsBtn");

    bioBtn = new Button();
    bioBtn.getStyleClass().add("bioBtn");
    bioBtn.setOnAction(
        e -> {
          rootPane.setCenter(biologyCourse.biologyPane());
        });

    // Course Web View
    try {
      courseView = new WebView();
      courseWebEngine = courseView.getEngine();
      courseView.setPrefHeight(860);
      courseView.setPrefWidth(width - 208);
    } catch (Exception excep) {
      System.out.println("<----- Exception in Course Web ----->");
      excep.printStackTrace();
      System.out.println("<---------->\n");
    }

    coursesGridPanel = new GridPane();
    coursesGridPanel.getStyleClass().add("gridPane");
    coursesGridPanel.setVgap(5);
    coursesGridPanel.setHgap(5);
    coursesGridPanel.setGridLinesVisible(false);
    coursesGridPanel.setPrefWidth(width - 208);
    coursesGridPanel.setPrefHeight(860);

    coursesGridPanel.setRowIndex(chemistryBtn, 1);
    coursesGridPanel.setColumnIndex(chemistryBtn, 1);
    coursesGridPanel.setRowIndex(physicsBtn, 1);
    coursesGridPanel.setColumnIndex(physicsBtn, 2);
    coursesGridPanel.setRowIndex(mathsBtn, 1);
    coursesGridPanel.setColumnIndex(mathsBtn, 3);
    coursesGridPanel.setRowIndex(bioBtn, 1);
    coursesGridPanel.setColumnIndex(bioBtn, 4);
    coursesGridPanel.getChildren().addAll(chemistryBtn, physicsBtn, mathsBtn, bioBtn);

    coursesPanel = new ScrollPane();
    coursesPanel.getStyleClass().add("scrollPane");
    coursesPanel.setPrefWidth(width - 118);
    coursesPanel.setPrefHeight(860);
    coursesPanel.setContent(coursesGridPanel);

    // ---------------------------------------------------------------------------------------------------> Courses Pane End

    // ---------------------------------------------------------------------------------------------> Simulations Pane Start
    final WebView browser = new WebView();
    final WebEngine webEngine = browser.getEngine();
    browser.setPrefHeight(860);
    browser.setPrefWidth(width - 208);

    /*
    File phetImageFile = new File("img/styleDark/poweredByPHET.png");
    String phetImageURL = phetImageFile.toURI().toURL().toString();
    Image phetImage = new Image(phetImageURL, false);
    */

    final ImageView phetImageView = new ImageView();
    final Image phetImage =
        new Image(Main.class.getResourceAsStream("img/styleDark/poweredByPHET.png"));
    phetImageView.setImage(phetImage);

    Label motionLbl = new Label("Motion");
    motionLbl.getStyleClass().add("lbl");

    forcesAndMotionBtn = new Button();
    forcesAndMotionBtn.getStyleClass().add("forcesAndMotionBtn");
    forcesAndMotionBtn.setOnAction(
        e -> {
          webEngine.load(
              "https://phet.colorado.edu/sims/html/balancing-act/latest/balancing-act_en.html");
          simsPanel.setContent(browser);
        });

    balancingActBtn = new Button();
    balancingActBtn.getStyleClass().add("balancingActBtn");
    balancingActBtn.setOnAction(
        e -> {
          webEngine.load(
              "https://phet.colorado.edu/sims/html/balancing-act/latest/balancing-act_en.html");
          simsPanel.setContent(browser);
        });

    energySkateParkBtn = new Button();
    energySkateParkBtn.getStyleClass().add("energySkateParkBtn");
    energySkateParkBtn.setOnAction(
        e -> {
          webEngine.load(
              "https://phet.colorado.edu/sims/html/energy-skate-park-basics/latest/"
                  + "energy-skate-park-basics_en.html");
          simsPanel.setContent(browser);
        });

    balloonsAndStaticElectricityBtn = new Button();
    balloonsAndStaticElectricityBtn.getStyleClass().add("balloonsAndStaticElectricityBtn");
    balloonsAndStaticElectricityBtn.setOnAction(
        e -> {
          webEngine.load(
              "https://phet.colorado.edu/sims/html/balloons-and-static-electricity/latest/"
                  + "balloons-and-static-electricity_en.html");
          simsPanel.setContent(browser);
        });

    buildAnAtomBtn = new Button();
    buildAnAtomBtn.getStyleClass().add("buildAnAtomBtn");
    buildAnAtomBtn.setOnAction(
        e -> {
          webEngine.load(
              "https://phet.colorado.edu/sims/html/build-an-atom/latest/build-an-atom_en.html");
          simsPanel.setContent(browser);
        });

    colorVisionBtn = new Button();
    colorVisionBtn.getStyleClass().add("colorVisionBtn");
    colorVisionBtn.setOnAction(
        e -> {
          webEngine.load(
              "https://phet.colorado.edu/sims/html/color-vision/latest/color-vision_en.html");
          simsPanel.setContent(browser);
        });

    Label soundAndWavesLbl = new Label("Sound and Waves");
    soundAndWavesLbl.getStyleClass().add("lbl");

    wavesOnAStringBtn = new Button();
    wavesOnAStringBtn.getStyleClass().add("wavesOnAStringBtn");
    wavesOnAStringBtn.setOnAction(
        e -> {
          webEngine.load(
              "https://phet.colorado.edu/sims/html/wave-on-a-string/latest/wave-on-a-string_en.html");
          simsPanel.setContent(browser);
        });

    /*
    motionSimsFlowPane = new FlowPane();
    motionSimsFlowPane.getStyleClass().add("flowPane");
    motionSimsFlowPane.setVgap(5);
    motionSimsFlowPane.setHgap(5);
    motionSimsFlowPane.setAlignment(Pos.TOP_LEFT);
    motionSimsFlowPane.getChildren().addAll(forcesAndMotionBtn, balancingActBtn, energySkateParkBtn,
            buildAnAtomBtn, colorVisionBtn, wavesOnAStringBtn);


    soundAndWavesFlowPane = new FlowPane();
    soundAndWavesFlowPane.getStyleClass().add("flowPane");
    soundAndWavesFlowPane.setVgap(5);
    soundAndWavesFlowPane.setHgap(5);
    soundAndWavesFlowPane.setAlignment(Pos.TOP_LEFT);
    soundAndWavesFlowPane.getChildren().addAll(wavesOnAStringBtn);


    simsBox = new VBox();
    simsBox.getStyleClass().add("vbox");
    simsBox.setPrefHeight(height);
    simsBox.setPrefWidth(width);
    simsBox.getChildren().addAll(motionLbl, motionSimsFlowPane, soundAndWavesLbl, soundAndWavesFlowPane);
    */

    simsGridPanel = new GridPane();
    simsGridPanel.getStyleClass().add("gridPane");
    simsGridPanel.setVgap(5);
    simsGridPanel.setHgap(5);
    simsGridPanel.setGridLinesVisible(false);
    simsGridPanel.setPrefWidth(width - 208);
    simsGridPanel.setPrefHeight(860);

    simsGridPanel.setRowIndex(phetImageView, 0);
    simsGridPanel.setColumnIndex(phetImageView, 4);

    simsGridPanel.setRowIndex(motionLbl, 0);
    simsGridPanel.setColumnIndex(motionLbl, 0);
    simsGridPanel.setRowIndex(forcesAndMotionBtn, 1);
    simsGridPanel.setColumnIndex(forcesAndMotionBtn, 0);
    simsGridPanel.setRowIndex(balancingActBtn, 1);
    simsGridPanel.setColumnIndex(balancingActBtn, 1);
    simsGridPanel.setRowIndex(energySkateParkBtn, 1);
    simsGridPanel.setColumnIndex(energySkateParkBtn, 2);
    simsGridPanel.setRowIndex(buildAnAtomBtn, 1);
    simsGridPanel.setColumnIndex(buildAnAtomBtn, 3);
    simsGridPanel.setRowIndex(colorVisionBtn, 1);
    simsGridPanel.setColumnIndex(colorVisionBtn, 4);

    simsGridPanel.setRowIndex(soundAndWavesLbl, 2);
    simsGridPanel.setColumnIndex(soundAndWavesLbl, 0);
    simsGridPanel.setColumnSpan(soundAndWavesLbl, 4);
    simsGridPanel.setRowIndex(wavesOnAStringBtn, 3);
    simsGridPanel.setColumnIndex(wavesOnAStringBtn, 0);

    simsGridPanel
        .getChildren()
        .addAll(
            phetImageView,
            motionLbl,
            forcesAndMotionBtn,
            balancingActBtn,
            energySkateParkBtn,
            buildAnAtomBtn,
            colorVisionBtn,
            soundAndWavesLbl,
            wavesOnAStringBtn);

    simsPanel = new ScrollPane();
    simsPanel.getStyleClass().add("scrollPane");
    simsPanel.setContent(simsGridPanel);

    // -----------------------------------------------------------------------------------------------> Simulations Pane End

    // ---------------------------------------------------------------------------------------------> Text Editor Pane Start

    htmlEditor = new HTMLEditor();
    htmlEditor.setPrefHeight(860);
    htmlEditor.setPrefWidth(width - 208);

    // Prevents Scroll on Space Pressed
    htmlEditor.addEventFilter(
        KeyEvent.KEY_PRESSED,
        new EventHandler<KeyEvent>() {
          @Override
          public void handle(KeyEvent event) {
            if (event.getEventType() == KeyEvent.KEY_PRESSED) {
              if (event.getCode() == KeyCode.SPACE) {
                event.consume();
              }
            }
          }
        });

    XWPFDocument document = new XWPFDocument();
    XWPFParagraph tmpParagraph = document.createParagraph();
    XWPFRun tmpRun = tmpParagraph.createRun();

    saveDocBtn = new Button();
    saveDocBtn.getStyleClass().add("btn");
    saveDocBtn.setText("Save");
    saveDocBtn.setOnAction(
        e -> {
          tmpRun.setText(tools.stripHTMLTags(htmlEditor.getHtmlText()));
          tmpRun.setFontSize(12);
          saveDocument(document, primaryStage);
        });

    textEditorPanel = new ScrollPane();
    textEditorPanel.getStyleClass().add("scrollPane");
    textEditorPanel.setContent(htmlEditor);

    // -----------------------------------------------------------------------------------------------> Text Editor Pane End

    // -------------------------------------------------------------------------------------------------> Wolfram Pane Start

    Boolean wolframActive = false;
    try {
      final WebView wolframWeb = new WebView();
      wolframWeb.getStyleClass().add("webView");
      final WebEngine wolframWebEngine = wolframWeb.getEngine();
      wolframWeb.setPrefHeight(860);
      wolframWeb.setPrefWidth(width - 208);
      if (wolframActive == false) {
        wolframWebEngine.load("http://www.wolframalpha.com/");
        wolframActive = true;
      }
      wolframPanel = new ScrollPane();
      wolframPanel.setContent(wolframWeb);
    } catch (Exception excep) {
      System.out.println("<----- Exception in Wolfram Alpha Web ----->");
      excep.printStackTrace();
      System.out.println("<---------->\n");
    }

    // ---------------------------------------------------------------------------------------------------> Wolfram Pane End

    // ------------------------------------------------------------------------------------------------> Wikipedia Pane Start

    Boolean wikipediaActive = false;
    try {
      final WebView wikipediaWeb = new WebView();
      wikipediaWeb.getStyleClass().add("scrollPane");
      wikipediaWebEngine = wikipediaWeb.getEngine();
      wikipediaWeb.setPrefHeight(860);
      wikipediaWeb.setPrefWidth(width - 208);
      if (wikipediaActive == false) {
        wikipediaWebEngine.load("https://en.wikipedia.org/wiki/Main_Page");
        wikipediaActive = true;
      }
      wikipediaPanel = new ScrollPane();
      wikipediaPanel.setContent(wikipediaWeb);
    } catch (Exception e) {
      e.printStackTrace();
    }

    // --------------------------------------------------------------------------------------------------> Wikipedia Pane End

    // -------------------------------------------------------------------------------------------------> Settings Pane Start

    settingsGridPanel = new GridPane();
    settingsGridPanel.getStyleClass().add("gridPane");
    settingsGridPanel.setPrefWidth(width - 208);
    settingsGridPanel.setPrefHeight(height);
    settingsGridPanel.setVgap(5);
    settingsGridPanel.setHgap(5);

    settingsPanel = new ScrollPane();
    settingsPanel.getStyleClass().add("scrollPane");
    settingsPanel.setContent(settingsGridPanel);

    // ---------------------------------------------------------------------------------------------------> Settings Pane End
    rootPane = new BorderPane();
    rootPane.setLeft(leftPanel);
    rootPane.setTop(topPanel);
    rootPane.setCenter(dashBoardBase);
    rootPane.getStyleClass().add("rootPane");
    rootPane.getStylesheets().add(Main.class.getResource("css/styleDark.css").toExternalForm());

    programWidth = primaryStage.getWidth();
    programHeight = primaryStage.getHeight();

    primaryStage.setTitle("ALE");
    primaryStage.initStyle(StageStyle.UNDECORATED);
    primaryStage
        .getIcons()
        .add(new javafx.scene.image.Image(Main.class.getResourceAsStream("img/aleIcon.png")));
    primaryStage.setScene(new Scene(rootPane, width, height));
    primaryStage.show();
  }