コード例 #1
0
  @Override
  public void start(Stage primaryStage) {
    primaryStage.setTitle("CoAP Explorer");
    Group root = new Group();
    Scene scene = new Scene(root, 800, 600);

    TextArea hexArea = new TextArea();
    TextArea binArea = new TextArea();

    CoapPacket packet = new CoapPacket();
    packet.setPayload("PAYLOAD");
    packetProp.setValue(packet);

    binArea.textProperty().bindBidirectional(packetProp, new AsciiConverter());

    hexArea.textProperty().bindBidirectional(packetProp, new HexConverter());
    hexArea.setEditable(false);
    hexArea.setFont(javafx.scene.text.Font.font(Font.MONOSPACED));

    VBox vbox = new VBox();
    vbox.setPadding(new Insets(10));
    vbox.setSpacing(8);

    VBox.setMargin(hexArea, new Insets(0, 0, 0, 8));
    vbox.getChildren().add(hexArea);
    VBox.setMargin(binArea, new Insets(0, 0, 0, 8));
    vbox.getChildren().add(binArea);

    root.getChildren().add(vbox);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
コード例 #2
0
 @FXML
 private void initialize() {
   textArea.setEditable(false);
   imageView.setImage(null);
   String imageResourceClass = getClass().getResource("recording.jpg").toString();
   recordingImage = new Image(imageResourceClass);
 }
コード例 #3
0
  private void showDialog(String title, String message, Throwable throwable) {
    Alert alert = new Alert(Alert.AlertType.ERROR);
    alert.setTitle(title);
    alert.setHeaderText(title);
    alert.setContentText(message);
    StringWriter stringWriter = new StringWriter();
    PrintWriter printwriter = new PrintWriter(stringWriter);
    throwable.printStackTrace(printwriter);
    String exceptionText = stringWriter.toString();

    Label label = new Label("The exception stacktrace was:");

    TextArea textArea = new TextArea(exceptionText);
    textArea.setEditable(false);
    textArea.setWrapText(true);

    textArea.setMaxWidth(Double.MAX_VALUE);
    textArea.setMaxHeight(Double.MAX_VALUE);
    GridPane.setVgrow(textArea, Priority.ALWAYS);
    GridPane.setHgrow(textArea, Priority.ALWAYS);

    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    expContent.add(label, 0, 0);
    expContent.add(textArea, 0, 1);

    alert.getDialogPane().setExpandableContent(expContent);
    alert.showAndWait();
  }
コード例 #4
0
ファイル: ViewChat.java プロジェクト: FPT2015/u5u6
  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);
  }
コード例 #5
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();
  }
コード例 #6
0
  public MainScreenView(final MainScreenController controller) {
    // Setup Job  List:
    listView_jobs.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    // Setup output area:
    textArea_output.setEditable(false);
    textArea_output.setFocusTraversable(false);

    // Set Component Tooltips:
    button_createJob.setTooltip(new Tooltip("Open the Job creation dialog to create a new Job."));
    button_deleteSelectedJobs.setTooltip(
        new Tooltip("Removes all Jobs that are currently selected on the list."));
    button_deleteAllJobs.setTooltip(new Tooltip("Clears the list of all Jobs."));
    button_clearOutput.setTooltip(new Tooltip("Clears the output screen."));
    button_editSettings.setTooltip(new Tooltip("Open the settings menu."));
    button_encode.setTooltip(new Tooltip("Encodes the selected handler(s)."));
    button_decode.setTooltip(
        new Tooltip(
            "Decodes the selected handler(s).\n\n"
                + "No checking is done to see if the files have ever been encoded,\n"
                + "so it's up to you to ensure you're decoding the correct files."));

    // Set Component EventHandlers:
    button_createJob.setOnAction(controller);
    button_encode.setOnAction(controller);
    button_decode.setOnAction(controller);
    button_deleteSelectedJobs.setOnAction(controller);
    button_deleteAllJobs.setOnAction(controller);
    button_clearOutput.setOnAction(controller);
    button_editSettings.setOnAction(controller);

    // Setup the Layout:
    final HBox panel_left_top = new HBox(10);
    panel_left_top.setAlignment(Pos.CENTER);
    panel_left_top
        .getChildren()
        .addAll(button_createJob, button_deleteSelectedJobs, button_deleteAllJobs);

    final HBox panel_left_bottom = new HBox(10);
    panel_left_bottom.setAlignment(Pos.CENTER);
    panel_left_bottom.getChildren().addAll(button_encode, button_decode);

    final VBox panel_left = new VBox(4);
    HBox.setHgrow(panel_left, Priority.ALWAYS);
    VBox.setVgrow(listView_jobs, Priority.ALWAYS);
    panel_left.getChildren().addAll(panel_left_top, listView_jobs, panel_left_bottom);

    final BorderPane panel_right_bottom = new BorderPane();
    panel_right_bottom.setLeft(button_clearOutput);
    panel_right_bottom.setRight(button_editSettings);

    final VBox panel_right = new VBox(4);
    HBox.setHgrow(panel_right, Priority.ALWAYS);
    VBox.setVgrow(textArea_output, Priority.ALWAYS);
    panel_right.getChildren().addAll(textArea_output, panel_right_bottom);

    this.setSpacing(4);
    this.getChildren().addAll(panel_left, panel_right);
  }
コード例 #7
0
ファイル: A_RayGUI.java プロジェクト: mannymang/A-Ray
  @Override
  public void start(Stage primaryStage) {

    Label inputLabel = new Label("Input");

    TextArea input = new TextArea();
    input.setFont(MONOSPACE_FONT);
    setSize(input, INPUT_WIDTH, INPUT_HEIGHT);

    Label outputLabel = new Label("Output");

    TextArea output = new TextArea();
    output.setEditable(false);
    output.setFont(MONOSPACE_FONT);
    setSize(output, OUTPUT_WIDTH, OUTPUT_HEIGHT);

    TextArea codeArea = new TextArea();
    codeArea.setFont(MONOSPACE_FONT);
    setSize(codeArea, EDITOR_WIDTH, EDITOR_HEIGHT);

    Button runButton = new Button("Run");
    runButton.setOnAction(
        e -> {
          try {
            output.setText(new A_RayCode(codeArea.getText(), input.getText()).runAndGetOutput());
          } catch (RuntimeException exception) {
            output.setText("Error");
            exception.printStackTrace();
          }
        });

    Button clearOutput = new Button("Clear Output");
    clearOutput.setOnAction(
        e -> {
          output.setText("");
        });

    HBox buttonPane = new HBox();
    buttonPane.setSpacing(PANE_SPACING);
    buttonPane.setAlignment(Pos.CENTER_RIGHT);
    buttonPane.getChildren().addAll(clearOutput, runButton);

    VBox mainPane = new VBox();
    mainPane.setPadding(MAIN_PANE_INSETS);
    mainPane.setSpacing(PANE_SPACING);

    mainPane.getChildren().addAll(codeArea, buttonPane, inputLabel, input, outputLabel, output);

    BorderPane content = new BorderPane(mainPane);

    Scene scene = new Scene(content, WIDTH, HEIGHT);

    primaryStage.setScene(scene);
    primaryStage.setResizable(false);
    primaryStage.show();
  }
コード例 #8
0
ファイル: TextMetricViewer.java プロジェクト: etamponi/game
 public TextMetricViewer() {
   content.setStyle("-fx-font-family: monospace;");
   content.setEditable(false);
   content.setPrefSize(800, 120);
   AnchorPane.setTopAnchor(content, 14.0);
   AnchorPane.setLeftAnchor(content, 14.0);
   AnchorPane.setRightAnchor(content, 14.0);
   AnchorPane.setBottomAnchor(content, 14.0);
   pane.getChildren().add(content);
 }
コード例 #9
0
  private VBox initGUIcenterLinks() {
    VBox senkrecht = new VBox();

    HBox zeile1 = new HBox(10);
    zeile1.setPadding(new Insets(5, 5, 5, 5));
    zeile1.setStyle(Css.boxgrau());
    TextArea zustandDatenbank = new TextArea();
    zustandDatenbank.getStyleClass().add("textarea80");
    zustandDatenbank.setStyle(Css.focusrahmenWeg());
    zustandDatenbank.setEditable(false);
    zustandDatenbank.setPrefRowCount(2);
    zustandDatenbank.setPrefColumnCount(23);
    zustandDatenbank.setWrapText(true);
    RahmenTitelWeiss rahmenZustandDatenbank =
        new RahmenTitelWeiss("Zustand der Datenbank", zustandDatenbank);
    Button knopfDatenbank = new Button("aktualisieren");
    zeile1.getChildren().add(rahmenZustandDatenbank);
    zeile1.getChildren().add(knopfDatenbank);

    VBox zeile2 = new VBox(10);
    zeile2.setPadding(new Insets(10, 10, 10, 10));
    zeile2.setStyle(Css.boxgrau());
    HBox zeileTabelle = new HBox(10);
    Button knopfAlle = new Button("alle auswählen");
    Button knopfKeinen = new Button("keinen auswählen");
    zeileTabelle.getChildren().add(knopfAlle);
    zeileTabelle.getChildren().add(knopfKeinen);
    zeile2.getChildren().add(initGUItabelle());
    zeile2.getChildren().add(zeileTabelle);

    VBox zeile3 = new VBox(10);
    zeile3.setPadding(new Insets(10, 10, 10, 10));
    zeile3.setStyle(Css.boxhellblaugrau());
    Button knopfDateiTextAlles = new Button("Projektstammdaten als Datei speichern (Text)");
    Button knopfDateiXmlAlles = new Button("Projektstammdaten als Datei speichern (Xml)");
    zeile3.getChildren().add(knopfDateiTextAlles);
    zeile3.getChildren().add(knopfDateiXmlAlles);

    VBox zeile4 = new VBox(10);
    zeile4.setPadding(new Insets(10, 10, 10, 10));
    zeile4.setStyle(Css.boxhellblau());
    Button knopfProjektAlles = new Button("alle Daten und Datein lokal speichern");
    zeile4.getChildren().add(knopfProjektAlles);

    senkrecht.getChildren().add(zeile1);
    senkrecht.getChildren().add(zeile2);
    senkrecht.getChildren().add(zeile3);
    senkrecht.getChildren().add(zeile4);

    return senkrecht;
  }
コード例 #10
0
  private HBox initGUIcenterRechtsZeile7() {
    HBox zeile = new HBox(10);

    TextArea info = new TextArea();
    info.setPrefRowCount(6);
    info.setPrefColumnCount(36);
    info.setWrapText(true);
    info.setEditable(false);
    RahmenTitelWeiss rahmenLoginname = new RahmenTitelWeiss("Info", info);

    ListView<String> gruppen = new ListView<String>();
    gruppen.setPrefWidth(190);
    gruppen.setPrefHeight(50);
    RahmenTitelWeiss rahmenGruppen = new RahmenTitelWeiss("Gruppen", gruppen);

    zeile.getChildren().add(rahmenLoginname);
    zeile.getChildren().add(rahmenGruppen);
    return zeile;
  }
コード例 #11
0
  @FXML
  private void initialize() {
    ideaCategoryColumn.setCellValueFactory(cellData -> cellData.getValue().categoryProperty());
    ideaNameColumn.setCellValueFactory(cellData -> cellData.getValue().nameProperty());
    ideaStatusColumn.setCellValueFactory(cellData -> cellData.getValue().statusProperty());

    ideasTable
        .getSelectionModel()
        .selectedItemProperty()
        .addListener((observable, oldValue, newValue) -> showIdea(newValue));

    int divider = 3; // amount of column to divide equal

    ideaCategoryColumn.prefWidthProperty().bind(ideasTable.widthProperty().divide(divider));

    ideaArea.setEditable(false);
    ideaArea.setWrapText(true);

    new Thread(
            new Runnable() {

              @Override
              public void run() {

                IdeaDaoImpl ideaDaoImpl = new IdeaDaoImpl();
                ideaDaoImpl.createConnection();
                ideasList.addAll(ideaDaoImpl.getAllIdeasList());
                ideaDaoImpl.closeConnection();

                Platform.runLater(
                    new Runnable() {

                      @Override
                      public void run() {

                        ideasTable.setItems(ideasList);
                      }
                    });
              }
            })
        .start();
  }
コード例 #12
0
 /**
  * Create a scroll pane of one of the databases
  *
  * @param type A string of either SQLInterface.TABITEM or SQLInterface.TABPERSON used to determine
  *     which database to print.
  * @return A scroll pane showing the database chosen in the parameter or the person database by
  *     default.
  * @throws IOException
  */
 public static ScrollPane printDatabase(String type) throws IOException {
   TextArea textArea;
   switch (type) {
     case (SQLInterface.TABITEM):
       textArea = new TextArea(itemDatabase.getDatabase().toString());
       break;
     case (SQLInterface.TABPERSON):
       textArea = new TextArea(personDatabase.getDatabase().toString());
       break;
     default:
       textArea = new TextArea(personDatabase.getDatabase().toString());
       break;
   }
   textArea.setEditable(false); // stop the user being able to edit this and thinking it will save.
   ScrollPane scrollPane = new ScrollPane(textArea);
   textArea.setWrapText(true);
   scrollPane.setHvalue(600);
   scrollPane.setVvalue(800);
   return scrollPane;
 }
コード例 #13
0
ファイル: ErlyBerly.java プロジェクト: InoMurko/erlyberly
  public static void showSourceCodeWindow(String title, String moduleSourceCode) {
    assert Platform.isFxApplicationThread();

    TextArea textArea;

    textArea = new TextArea(moduleSourceCode);
    textArea.getStyleClass().add("mod-src");
    textArea.setEditable(false);

    Scene scene = new Scene(textArea, 800, 800);
    ErlyBerly.applyCssToWIndow(scene);

    Stage primaryStage;

    primaryStage = new Stage();
    primaryStage.setTitle(title);
    primaryStage.setScene(scene);
    primaryStage.show();

    CloseWindowOnEscape.apply(scene, primaryStage);
  }
コード例 #14
0
  private HBox initGUIcenterRechtsDatenbank() {
    HBox zeile = new HBox(20);
    zeile.setPadding(new Insets(5, 5, 5, 5));
    zeile.setStyle(Css.boxhellblaugrau());

    TextArea antwortDatenbank = new TextArea();
    antwortDatenbank.getStyleClass().add("textareaFlat");
    antwortDatenbank.setStyle(Css.focusrahmenWeg());
    antwortDatenbank.setEditable(false);
    antwortDatenbank.setPrefRowCount(3);
    antwortDatenbank.setPrefColumnCount(25);
    antwortDatenbank.setWrapText(true);
    RahmenTitelWeiss rahmenAntwortDatenbank =
        new RahmenTitelWeiss("Antwort Datenbank", antwortDatenbank);

    VBox senkrecht = new VBox(5);
    Label schildchenAktion = new Label("Aktion");
    schildchenAktion.setStyle(CssExtras.titel());

    ToggleGroup gruppe = new ToggleGroup();

    RadioButton knopfArchivieren = new RadioButton("aktivieren");
    knopfArchivieren.setToggleGroup(gruppe);

    RadioButton knopfLöschen = new RadioButton("löschen");
    knopfLöschen.setToggleGroup(gruppe);

    senkrecht.getChildren().add(schildchenAktion);
    senkrecht.getChildren().add(knopfArchivieren);
    senkrecht.getChildren().add(knopfLöschen);

    Button knopfSenden = new Button("senden");

    zeile.getChildren().add(rahmenAntwortDatenbank);
    zeile.getChildren().add(senkrecht);
    zeile.getChildren().add(knopfSenden);
    return zeile;
  }
コード例 #15
0
ファイル: ORCAClient.java プロジェクト: inventeam/orcaclient
  public Pane createRoot(double spacing) {
    final String ipAddressPattern = "\\d{3}.\\d{3}.\\d.\\d";
    final String portPattern = "\\d{2}|\\d{4}";

    final TextArea status = new TextArea();
    status.setEditable(false);
    orca.messageProperty()
        .addListener(
            new ChangeListener<String>() {
              @Override
              public void changed(ObservableValue<? extends String> ov, String t, String t1) {
                status.appendText(t1);
              }
            });

    BorderPane root = new BorderPane();
    root.setPadding(new Insets(spacing));
    root.setLeft(createORCADatePane(spacing));
    root.setCenter(createChartsPane(spacing));
    root.setRight(createControlsPane(spacing));
    root.setBottom(status);
    return root;
  }
コード例 #16
0
  @Override
  public void start(Stage stage) {
    try {
      Parent root = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));

      Scene scene = new Scene(root);

      stage.setScene(scene);
      stage.show();
    } catch (Exception ex) {
      Alert alert = new Alert(Alert.AlertType.ERROR);
      alert.setTitle("Lobo Software");
      alert.setHeaderText("Se ha presentado un error inesperado");
      alert.setContentText("El error técnico se muestra a continuación:");

      StringWriter sw = new StringWriter();
      PrintWriter pw = new PrintWriter(sw);
      ex.printStackTrace(pw);
      String exceptionText = sw.toString();

      TextArea textArea = new TextArea(exceptionText);
      textArea.setEditable(false);
      textArea.setWrapText(true);

      textArea.setMaxWidth(Double.MAX_VALUE);
      textArea.setMaxHeight(Double.MAX_VALUE);
      GridPane.setVgrow(textArea, Priority.ALWAYS);
      GridPane.setHgrow(textArea, Priority.ALWAYS);

      GridPane expContent = new GridPane();
      expContent.setMaxWidth(Double.MAX_VALUE);
      expContent.add(textArea, 0, 1);

      alert.getDialogPane().setExpandableContent(expContent);
      alert.showAndWait();
    }
  }
コード例 #17
0
 public SaveDialog(final Stage stg, String text) {
   width = 300;
   height = 100;
   final Stage stage = new Stage();
   stage.initModality(Modality.APPLICATION_MODAL);
   stage.initOwner(stg);
   stage.setTitle("提示框");
   Group root = new Group();
   AnchorPane anchorPane = new AnchorPane();
   area = new TextArea();
   area.setFont(new Font(30));
   area.setEditable(false);
   area.setWrapText(true);
   area.setPrefWidth(width);
   area.setPrefHeight(height);
   System.out.println(area.getWidth());
   System.out.println(area.getHeight());
   Scene scene = new Scene(root, width, height);
   area.setText(text);
   anchorPane.getChildren().add(area);
   root.getChildren().add(anchorPane);
   stage.setScene(scene);
   stage.show();
 }
コード例 #18
0
ファイル: Server_View.java プロジェクト: alenoe/KingOfTokyo
  /**
   * Das GUI besteht aus zwei wesentlichen Komponenten, einer GridPane namens entryArea und einem
   * TextAreaHandler, beide sind in eine BorderPane eingebettet.
   */
  @Override
  protected Scene create_GUI() {

    // ServiceLocator und Translator werden gesetzt.
    ServiceLocator sl = ServiceLocator.getServiceLocator();
    Translator t = sl.getTranslator();

    // Die MenuBar enthält die Sprachauswahl
    MenuBar menuBar = new MenuBar();
    menuFile = new Menu(t.getString("program.menu.file"));
    menuFileLanguage = new Menu(t.getString("program.menu.file.language"));
    menuFile.getItems().add(menuFileLanguage);

    for (Locale locale : sl.getLocales()) {
      MenuItem language = new MenuItem(locale.getLanguage());
      menuFileLanguage.getItems().add(language);
      language.setOnAction(
          event -> {
            sl.setTranslator(new Translator(locale.getLanguage()));
            updateTexts();
          });
    }

    BorderPane root = new BorderPane();
    root.setPrefSize(409, 219);

    menuBar.getMenus().addAll(menuFile);
    root.setTop(menuBar);

    /**
     * ______________________________________________________________________________________________
     * START OF GRIDPANE !!! ENTRYAREA !!!
     */

    // Serverentry Area
    GridPane entryArea = new GridPane();
    entryArea.setAlignment(Pos.CENTER);
    root.setCenter(entryArea);

    Label lblIP = new Label();
    lblIP.setText("IP: ");
    ;
    lblIP.setAlignment(Pos.CENTER_LEFT);
    entryArea.add(lblIP, 0, 0);
    GridPane.setMargin(lblIP, new Insets(5, 5, 0, 50));

    Label lblPort = new Label();
    lblPort.setText("Port: ");
    lblPort.setAlignment(Pos.CENTER_LEFT);
    entryArea.add(lblPort, 0, 1);
    GridPane.setMargin(lblPort, new Insets(5, 5, 0, 50));

    lblHostName = new Label();
    lblHostName.setAlignment(Pos.CENTER_LEFT);
    lblHostName.setId("lblHostName");
    entryArea.add(lblHostName, 0, 2);
    GridPane.setMargin(lblHostName, new Insets(5, 5, 0, 50));

    tfIP = new TextField();
    tfIP.setId("tfIP");
    tfIP.setEditable(false);
    entryArea.add(tfIP, 1, 0);
    GridPane.setMargin(tfIP, new Insets(5, 5, 0, 0));

    tfPort = new TextField();
    tfPort.setId("tfPort");
    tfPort.setText("14000");
    tfPort.setPromptText("Bitte Portnummer eingeben.");
    entryArea.add(tfPort, 1, 1);
    GridPane.setMargin(tfPort, new Insets(5, 5, 0, 0));

    btnStart = new Button();
    btnStart.setId("btnStart");
    btnStart.setText(t.getString("button.start"));
    entryArea.add(btnStart, 2, 0);
    GridPane.setMargin(btnStart, new Insets(5, 5, 0, 50));

    btnClose = new Button();
    btnClose.setId("btnClose");
    btnClose.setText(t.getString("button.close"));
    entryArea.add(btnClose, 2, 1);
    GridPane.setMargin(btnClose, new Insets(5, 5, 0, 50));

    /**
     * ______________________________________________________________________________________________
     * START OF !!! TEXTAREAHANDLER !!!
     */
    textAreaHandler = new TextAreaHandler();
    taLogger = textAreaHandler.getTextArea();
    taLogger.setId("taLogger");
    taLogger.setEditable(false);
    root.setBottom(taLogger);

    Scene scene = new Scene(root);

    return scene;
  }
コード例 #19
0
  @Override
  public void start(Stage primaryStage) {

    VBox loginPane = new VBox();
    loginPane.setAlignment(Pos.CENTER);
    primaryStage.setTitle("Amoeba");
    primaryStage.setScene(new Scene(loginPane, 800, 600));
    primaryStage.show();

    TextField username = new TextField();
    username.setPromptText("Username");
    username.setMaxSize(200, 50);

    Timeline renderTimer = new Timeline();
    Timeline inputTimer = new Timeline();

    ColorPicker colorPicker = new ColorPicker();
    colorPicker.setEditable(true);
    colorPicker.setValue(Color.BLACK);

    lagLabel.setTranslateX(25);
    lagLabel.setTranslateY(10);
    lagLabel.setTextFill(Color.RED);

    TextField address = new TextField("localhost");
    address.setPromptText("Server IP Address");
    address.setMaxSize(200, 50);

    TextField port = new TextField("8080");
    port.setPromptText("Port Number");
    port.setMaxSize(200, 50);

    Button btn = new Button("Play");
    btn.setDefaultButton(true);

    loginPane.getChildren().addAll(username, colorPicker, address, port, btn);

    primaryStage.setResizable(false);
    music.setCycleCount(MediaPlayer.INDEFINITE);
    renderPane.setBackground(new Background(backgroundImage));
    renderPane.setPrefSize(800, 600);

    chatBox.setPrefSize(400, 100);
    chatBox.setTranslateX(0);
    chatBox.setTranslateY(468);
    chatBox.setWrapText(true);
    chatBox.setEditable(false);
    chatBox.setStyle("-fx-opacity: 0.5");

    chatInput.setPrefSize(400, 10);
    chatInput.setTranslateX(0);
    chatInput.setTranslateY(570);
    chatInput.setStyle("-fx-opacity: 0.8");

    highScores.setPrefSize(400, 210);
    highScores.setEditable(false);
    currentScores.setPrefSize(400, 250);
    currentScores.setEditable(false);
    currentScores.setLayoutY(210);
    scores.setTranslateX(-390);
    scores.setTranslateY(0);
    scores.setStyle("-fx-opacity: 0.8");

    scores.setOnMouseEntered(
        (e) -> {
          scores.setTranslateX(0);
        });

    scores.setOnMouseExited(
        (e) -> {
          if (e.getX() > 350) {
            scores.setTranslateX(-390);
          }
        });

    btn.setOnAction(
        (e) -> {
          if (!networkController.isConnected()) {
            networkController.connect(address.getText(), Integer.parseInt(port.getText()));
            if (username.getText().isEmpty()) {
              username.setText("Anonymous");
            }
            networkController.sendMessage(new LoginMessage(username.getText(), ""));

            ArrayList<KeyValuePair> properties = new ArrayList<>();
            properties.add(new KeyValuePair("color", colorPicker.getValue().toString()));
            networkController.sendMessage(new SetBlobPropertiesMessage(properties));

            primaryStage.setScene(new Scene(renderPane));
            renderTimer.play();
            inputTimer.play();
            music.play();
          }
        });

    inputTimer.setCycleCount(Timeline.INDEFINITE);
    inputTimer
        .getKeyFrames()
        .add(
            new KeyFrame(
                Duration.seconds(0.05),
                (e) -> {
                  if (sendCoordinates) {
                    networkController.sendMessage(new MoveTowardCoordinatesMessage(x, y));
                  }
                }));

    renderTimer.setCycleCount(Timeline.INDEFINITE);
    renderTimer
        .getKeyFrames()
        .add(
            new KeyFrame(
                Duration.seconds(0.01),
                (e) -> {
                  render();
                }));

    renderPane.setOnMouseReleased(
        (e) -> {
          this.sendCoordinates = false;
        });

    renderPane.setOnMouseDragged(
        (e) -> {
          this.sendCoordinates = true;
          this.x = e.getX();
          this.y = e.getY();
        });

    renderPane.setOnMouseClicked(
        (e) -> {
          if (e.getButton() == MouseButton.SECONDARY) {
            networkController.sendMessage(new BoostMessage());
          } else if (e.getClickCount() > 1 || e.getButton() == MouseButton.MIDDLE) {
            networkController.sendMessage(new SplitMessage());
          }
        });

    renderPane.setOnKeyPressed(
        (e) -> {
          if (e.getCode().equals(KeyCode.ENTER) && !chatInput.getText().isEmpty()) {
            networkController.sendMessage(new ChatMessage("", chatInput.getText()));
            chatInput.clear();
          }
        });

    primaryStage.setOnCloseRequest(
        (e) -> {
          networkController.sendMessage(new LogoutMessage());
          try {
            Thread.sleep(100);
          } catch (InterruptedException ex) {
            Logger.getLogger(AmoebaClient.class.getName()).log(Level.WARNING, null, ex);
          } finally {
            System.exit(0);
          }
        });
  }
コード例 #20
0
ファイル: SerieInfo.java プロジェクト: lelmarir/Filmista
  public SerieInfo(final Serie serie) {
    // TODO Auto-generated constructor stub

    GridPane grid = new GridPane();
    FlowPane flow = new FlowPane(Orientation.HORIZONTAL);
    flow.setAlignment(Pos.TOP_LEFT);
    flow.setHgap(40);

    DropShadow dropShadow = new DropShadow();
    dropShadow.setOffsetX(10);
    dropShadow.setOffsetY(10);
    dropShadow.setColor(Color.rgb(50, 50, 50, 0.7));

    Label poster = new Label();
    String style_inner =
        "-fx-font: Gill Sans;"
            + "-fx-font-family: Gill Sans;"
            + "-fx-effect: dropshadow(one-pass-box, black, 8, 0, 4, 4);";
    poster.setStyle(style_inner);

    final Label star = new Label();
    Image stella = new Image("img/greentick.png", 35, 35, true, true, true);
    star.setGraphic(new ImageView(stella));
    star.setVisible(false);

    ImageView image = new ImageView(serie.getPoster());
    poster.setGraphic(image);

    TextArea text = new TextArea();

    text.setPrefSize(600, 160);
    text.setText(serie.getOverview());
    text.setWrapText(true);
    text.setEditable(false);
    /*
     * text.setStyle("-fx-text-fill: black;"+ "-fx-font: Gill Sans;"+
     * "-fx-font-size: 13;" + "-fx-height:400");
     */

    text.setStyle(LABEL_STYLE);
    String name = null;
    if (serie.getNome().length() > 16) {
      name = serie.getNome().substring(0, 15);
      name = name.concat("...");
    } else {

      name = serie.getNome();
    }

    Label nome = new Label(name);
    nome.setTextFill(Color.BLACK);
    nome.setFont(Font.font("Helvetica", 28));

    final Button btn = new Button("  Add   ");
    ImageView imageview = new ImageView(new Image("img/add.png", 12, 12, true, true, true));
    btn.setGraphic(imageview);
    btn.setContentDisplay(ContentDisplay.LEFT);
    /*
     * String buttonCss = SerieInfo.class.getResource("CustomButton.css")
     * .toExternalForm(); btn.getStylesheets().add(buttonCss);
     */
    btn.getStyleClass().add("custom-browse");
    btn.setCursor(Cursor.HAND);
    btn.setTextFill(Color.WHITE);

    btn.addEventHandler(
        MouseEvent.MOUSE_CLICKED,
        new EventHandler<MouseEvent>() {
          @Override
          public void handle(MouseEvent e) {

            star.setVisible(true);

            if (Preferiti.getInstance().addToPreferiti(serie) == false) {

              /*
               * new MyDialog(Guiseries2.stage,
               * Modality.APPLICATION_MODAL, "Warning!", serie);
               */

            } else {

              btn.setDisable(true);
              btn.setText("  Added  ");
              btn.setGraphic(null);
              // torrent...
              DaemonManager manager = new DaemonManager();
              Search search =
                  new Search(
                      serie,
                      manager,
                      "ENG",
                      new SearchListener() {

                        @Override
                        public void SearchListener() {
                          Platform.runLater(
                              new Runnable() {

                                @Override
                                public void run() {

                                  boolean compare = false;
                                  for (int i = 0; i < serie.getStagioni().size(); i++) {

                                    for (int j = 0;
                                        j < serie.getStagioni().get(i).getEpisodiStagione().size();
                                        j++) {

                                      compare = false;

                                      if ((serie
                                              .getStagioni()
                                              .get(i)
                                              .getEpisodiStagione()
                                              .get(j)
                                              .getTorrent()
                                          != null)) {
                                        for (int k = (1 + j);
                                            k
                                                < serie
                                                    .getStagioni()
                                                    .get(i)
                                                    .getEpisodiStagione()
                                                    .size();
                                            k++) {

                                          if (serie
                                                  .getStagioni()
                                                  .get(i)
                                                  .getEpisodiStagione()
                                                  .get(k)
                                                  .getTorrent()
                                              != null) {
                                            if (serie
                                                .getStagioni()
                                                .get(i)
                                                .getEpisodiStagione()
                                                .get(j)
                                                .getTorrent()
                                                .getName()
                                                .equals(
                                                    serie
                                                        .getStagioni()
                                                        .get(i)
                                                        .getEpisodiStagione()
                                                        .get(k)
                                                        .getTorrent()
                                                        .getName())) {

                                              compare = true;
                                            }
                                          }
                                        }

                                        if (compare == false) {

                                          TorrentSeriesElement.getInstance()
                                              .addToTorrents(
                                                  serie
                                                      .getStagioni()
                                                      .get(i)
                                                      .getEpisodiStagione()
                                                      .get(j)
                                                      .getTorrent());
                                          if ((TorrentSeriesElement.getInstance()
                                                      .torrents
                                                      .indexOf(
                                                          serie
                                                              .getStagioni()
                                                              .get(i)
                                                              .getEpisodiStagione()
                                                              .get(j)
                                                              .getTorrent())
                                                  % 2)
                                              == 0) {

                                            TabDownload.mainDownload
                                                .getChildren()
                                                .add(
                                                    TabDownload.addTorrentEvenToDownloadTab(
                                                        serie
                                                            .getStagioni()
                                                            .get(i)
                                                            .getEpisodiStagione()
                                                            .get(j)
                                                            .getTorrent()));

                                          } else {

                                            TabDownload.mainDownload
                                                .getChildren()
                                                .add(
                                                    TabDownload.addTorrentOddToDownloadTab(
                                                        serie
                                                            .getStagioni()
                                                            .get(i)
                                                            .getEpisodiStagione()
                                                            .get(j)
                                                            .getTorrent()));
                                          }

                                          System.out.println(
                                              serie
                                                  .getStagioni()
                                                  .get(i)
                                                  .getEpisodiStagione()
                                                  .get(j)
                                                  .getTorrent()
                                                  .getName());
                                        }
                                      }
                                    }
                                  }

                                  try {

                                    FilmistaDb.getInstance().addSeriesToFilmistaDb(serie);
                                  } catch (ClassNotFoundException e1) {
                                    // TODO Auto-generated
                                    // catch
                                    // block
                                    e1.printStackTrace();
                                  } catch (IOException e1) {
                                    // TODO Auto-generated
                                    // catch
                                    // block
                                    e1.printStackTrace();
                                  } catch (SQLException e1) {
                                    // TODO Auto-generated
                                    // catch
                                    // block
                                    e1.printStackTrace();
                                  }

                                  TabPreferiti.updateTab();
                                }
                              });
                        }
                      });
            }
          }
        });

    flow.getChildren().add(btn);
    flow.getChildren().add(nome);

    if (Preferiti.getInstance().series.contains(serie) == true) {

      btn.setText("  Added  ");
      btn.setDisable(true);
      star.setVisible(true);
      btn.setGraphic(null);
    }

    grid.setHgap(25);
    grid.setVgap(15);
    grid.add(poster, 0, 0, 1, 2);
    grid.add(flow, 1, 0);
    FlowPane paneStar = new FlowPane(Orientation.HORIZONTAL);
    paneStar.setAlignment(Pos.TOP_RIGHT);
    paneStar.getChildren().add(star);
    grid.add(paneStar, 2, 0, 1, 1);
    grid.add(text, 1, 1, 2, 1);

    grid.getColumnConstraints().add(0, new ColumnConstraints());
    grid.getColumnConstraints().add(1, new ColumnConstraints());
    grid.getColumnConstraints().add(2, new ColumnConstraints(150));

    // grid.setGridLinesVisible(true);
    grid.setHgrow(text, Priority.ALWAYS);
    grid.setVgrow(poster, Priority.ALWAYS);

    grid.setPadding(new Insets(25, 25, 25, 25));
    this.setCenter(grid);

    String customCss = SerieInfo.class.getResource("CustomBorder.css").toExternalForm();
    this.getStylesheets().add(customCss);
    this.getStyleClass().add("custom-border");
  }
コード例 #21
0
 @Override
 public void initialize(URL location, ResourceBundle resources) {
   dbTextArea.setEditable(false);
 }
コード例 #22
0
ファイル: EditorPane.java プロジェクト: kittylyst/jitwatch
  public EditorPane(ISandboxStage stage) {
    this.sandboxStage = stage;

    lblTitle = new Label("New File");

    Button btnOpen = StyleUtil.buildButton("Open");
    btnOpen.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            promptSave();

            chooseFile();
          }
        });

    btnSave = StyleUtil.buildButton("Save");
    btnSave.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            saveFile();
          }
        });

    btnSave.setDisable(!isModified);

    Button btnClear = StyleUtil.buildButton("Clear");
    btnClear.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            lblTitle.setText("New File");
            taSource.setText(S_EMPTY);
          }
        });

    Button btnClose = StyleUtil.buildButton("Close");
    btnClose.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            promptSave();

            sandboxStage.editorClosed(EditorPane.this);
          }
        });

    Button btnRun = StyleUtil.buildButton("Run");
    btnRun.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            if (isModified) {
              promptSave();
            }

            setVMLanguage();

            sandboxStage.runFile(EditorPane.this);
          }
        });

    hBoxTitle = new HBox();
    hBoxTitle.setSpacing(10);
    hBoxTitle.setPadding(new Insets(0, 10, 0, 10));
    hBoxTitle.getChildren().add(lblTitle);
    hBoxTitle.getChildren().add(btnOpen);
    hBoxTitle.getChildren().add(btnSave);
    hBoxTitle.getChildren().add(btnClear);
    hBoxTitle.getChildren().add(btnClose);
    hBoxTitle.getChildren().add(btnRun);

    hBoxTitle.setStyle("-fx-background-color:#dddddd; -fx-padding:4px;");

    taSource = new TextArea();
    String styleSource =
        "-fx-font-family:monospace; -fx-font-size:12px; -fx-background-color:white;";
    taSource.setStyle(styleSource);

    taSource
        .textProperty()
        .addListener(
            new ChangeListener<String>() {
              @Override
              public void changed(
                  final ObservableValue<? extends String> observable,
                  final String oldValue,
                  final String newValue) {
                setModified(true);
              }
            });

    taSource
        .focusedProperty()
        .addListener(
            new ChangeListener<Boolean>() {
              @Override
              public void changed(
                  ObservableValue<? extends Boolean> arg0, Boolean oldValue, Boolean newValue) {
                if (Boolean.TRUE.equals(newValue)) {
                  setVMLanguage();
                }
              }
            });

    setTextAreaSaveCombo(taSource);

    taLineNumbers = new TextArea();
    String styleLineNumber =
        "-fx-padding:0; -fx-font-family:monospace; -fx-font-size:12px; -fx-background-color:#eeeeee;";
    taLineNumbers.setStyle(styleLineNumber);
    taLineNumbers.setEditable(false);
    taLineNumbers.setWrapText(true);

    HBox hBoxTextAreas = new HBox();

    hBoxTextAreas.getChildren().add(taLineNumbers);
    hBoxTextAreas.getChildren().add(taSource);

    taSource.prefWidthProperty().bind(hBoxTextAreas.widthProperty());

    getChildren().add(hBoxTitle);
    getChildren().add(hBoxTextAreas);

    hBoxTitle.prefWidthProperty().bind(widthProperty());
    hBoxTitle.prefHeightProperty().bind(heightProperty().multiply(0.1));

    hBoxTextAreas.prefWidthProperty().bind(widthProperty());
    hBoxTextAreas.prefHeightProperty().bind(heightProperty().multiply(0.9));
  }
コード例 #23
0
ファイル: Main.java プロジェクト: 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();
  }