@FXML
  private void buttonCheckClicked(Event event) {
    DefectSet leftSide = new DefectSet(prefix);
    DefectSet rightSide = new DefectSet(prefix);

    leftSide.load(textInputLeft.getText(), textPrefix.getText(), textMax.getText());
    rightSide.load(textInputRight.getText(), textPrefix.getText(), textMax.getText());

    labelInputLeft.setText(leftSide.size() + " defect(s) found.");
    labelInputRight.setText(rightSide.size() + " defect(s) found.");

    DefectSet outputLeft = leftSide.subtract(rightSide);
    DefectSet outputRight = rightSide.subtract(leftSide);
    DefectSet intersect = leftSide.intersect(rightSide);

    textOutputLeft.setStyle("-fx-text-fill: blue;");
    textOutputLeft.setText(outputLeft.listAll());
    labelOutputLeft.setText(outputLeft.size() + " missed defect(s) found.");

    textOutputRight.setStyle("-fx-text-fill: red;");
    textOutputRight.setText(outputRight.listAll());
    labelOutputRight.setText(outputRight.size() + " missed defect(s) found.");

    textOutputCenter.setStyle("-fx-text-fill: green;");
    textOutputCenter.setText(intersect.listAll());
    labelOutputCenter.setText(intersect.size() + " defect(s) covered by both side.");
  }
예제 #2
0
 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);
 }
예제 #3
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;
  }
예제 #4
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;
  }
예제 #5
0
  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));
  }
예제 #6
0
  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");
  }
예제 #7
0
  public SandboxStage(
      final IStageCloseListener closeListener, IStageAccessProxy proxy, final ILogParser parser) {
    this.accessProxy = proxy;

    config = parser.getConfig();

    config.switchToSandbox();

    setupVMLanguages();

    sandbox = new Sandbox(parser, this, this);

    setTitle("Sandbox - Code, Compile, Execute, and Analyse JIT logs");

    tabPane = new TabPane();

    tabPane
        .getSelectionModel()
        .selectedItemProperty()
        .addListener(
            new ChangeListener<Tab>() {
              @Override
              public void changed(ObservableValue<? extends Tab> ov, Tab t, Tab t1) {
                Tab selectedTab = tabPane.getSelectionModel().getSelectedItem();

                if (selectedTab != null) {
                  EditorPane pane = (EditorPane) selectedTab.getContent();

                  setVMLanguage(pane);
                }
              }
            });

    SplitPane splitVertical = new SplitPane();
    splitVertical.setOrientation(Orientation.VERTICAL);

    taLog = new TextArea();

    String style =
        "-fx-font-family:"
            + FONT_MONOSPACE_FAMILY
            + "; -fx-font-size:"
            + FONT_MONOSPACE_SIZE
            + "px; -fx-background-color:white;";

    taLog.setStyle(style);

    Button btnNewEditor = new Button("New Editor");
    btnNewEditor.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            addEditor(null);
          }
        });

    Button btnOpen = new Button("Open");
    btnOpen.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            if (tabPane.getSelectionModel().getSelectedItem() == null) {
              addEditor(null);
            }

            Tab selectedTab = tabPane.getSelectionModel().getSelectedItem();

            EditorPane pane = (EditorPane) selectedTab.getContent();

            if (pane.isModified()) {
              pane.promptSave();
            }

            FileChooser fc = new FileChooser();

            fc.setTitle("Choose source file");

            fc.setInitialDirectory(Sandbox.SANDBOX_SOURCE_DIR.toFile());

            File result = fc.showOpenDialog(getStageForChooser());

            if (result != null) {
              pane.loadSource(result);
              selectedTab.setText(pane.getName());

              setVMLanguage(pane);

              saveEditorPaneConfig();
            }
          }
        });

    Button btnSave = new Button("Save");
    btnSave.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            Tab selectedTab = tabPane.getSelectionModel().getSelectedItem();

            if (selectedTab != null) {
              EditorPane pane = (EditorPane) selectedTab.getContent();

              pane.saveFile();

              selectedTab.setText(pane.getName());

              setVMLanguage(pane);
            }
          }
        });

    btnSandboxConfig = new Button("Configure Sandbox");
    btnSandboxConfig.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            sandboxConfigStage = new SandboxConfigStage(SandboxStage.this, parser.getConfig());

            StageManager.addAndShow(SandboxStage.this, sandboxConfigStage);

            btnSandboxConfig.setDisable(true);
          }
        });

    Button btnResetSandbox = new Button("Reset Sandbox");
    btnResetSandbox.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            Response resp =
                Dialogs.showYesNoDialog(
                    SandboxStage.this,
                    "Reset Sandbox?",
                    "Delete all modified Sandbox sources and classes?");

            if (resp == Response.YES) {
              initialiseLog();
              sandbox.reset();
              loadDefaultEditors();
            }
          }
        });

    comboBoxVMLanguage
        .valueProperty()
        .addListener(
            new ChangeListener<String>() {
              @Override
              public void changed(
                  ObservableValue<? extends String> ov, String oldVal, String newVal) {
                if (newVal != null) {
                  log("Changed language to " + newVal);
                }
              }
            });

    Button btnRun = new Button("Run");
    btnRun.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            Tab selectedTab = tabPane.getSelectionModel().getSelectedItem();

            if (selectedTab != null) {
              EditorPane pane = (EditorPane) selectedTab.getContent();

              if (pane.isModified()) {
                pane.promptSave();
              }

              setVMLanguage(pane);

              runFile(pane);
            }
          }
        });

    Button btnOutput = new Button("View Output");
    btnOutput.setOnAction(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent e) {
            showOutput(AbstractProcess.getOutputStream());
          }
        });

    HBox hBoxTools = new HBox();

    hBoxTools.setSpacing(10);
    hBoxTools.setPadding(new Insets(10));

    hBoxTools.getChildren().add(btnNewEditor);
    hBoxTools.getChildren().add(btnOpen);
    hBoxTools.getChildren().add(btnSave);
    hBoxTools.getChildren().add(btnSandboxConfig);
    hBoxTools.getChildren().add(btnResetSandbox);
    hBoxTools.getChildren().add(comboBoxVMLanguage);
    hBoxTools.getChildren().add(btnRun);
    hBoxTools.getChildren().add(btnOutput);

    splitVertical.getItems().add(tabPane);
    splitVertical.getItems().add(taLog);

    splitVertical.setDividerPositions(0.75, 0.25);

    VBox vBoxMain = new VBox();
    vBoxMain.getChildren().add(hBoxTools);
    vBoxMain.getChildren().add(splitVertical);

    BorderPane borderPane = new BorderPane();
    borderPane.setTop(hBoxTools);
    borderPane.setCenter(splitVertical);

    initialiseLog();

    Scene scene = new Scene(borderPane, JITWatchUI.WINDOW_WIDTH, JITWatchUI.WINDOW_HEIGHT);

    setScene(scene);

    setOnCloseRequest(
        new EventHandler<WindowEvent>() {
          @Override
          public void handle(WindowEvent arg0) {
            saveEditorPaneConfig();

            StageManager.closeAll();
            closeListener.handleStageClosed(SandboxStage.this);
          }
        });

    loadLastEditorPanes();
  }
예제 #8
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);
          }
        });
  }