@Override public void start(Stage primaryStage) throws Exception { // UI fields VBox mainBox = new VBox(); sequenceField = new TextField(myLabels.TEXTAREA_SEQUENCE); bracketField = new TextField(myLabels.TEXTAREA_BRACKET); HBox buttonBox = new HBox(); Button computeButton = new Button(myLabels.BUTTON_COMPUTE); Button drawButton = new Button(myLabels.BUTTON_DRAW); CheckBox animateChecker = new CheckBox(myLabels.CHECKBOX_ANIMATE); drawPane = new Pane(); buttonBox.getChildren().addAll(computeButton, drawButton, animateChecker); mainBox.getChildren().addAll(sequenceField, bracketField, buttonBox, drawPane); // Compute Button disable sequenceField .textProperty() .addListener( (observable, oldValue, newValue) -> { if (newValue.length() == 0) { computeButton.setDisable(true); } else { computeButton.setDisable(false); } }); // Animate Checkbox animateChecker.setOnAction( (value) -> { if (animateChecker.isSelected() != isAnimated) { isAnimated = animateChecker.isSelected(); // set Eventhandler für Drag & Drop for (Circle currentCircle : circleList) { currentCircle.setOnMousePressed(isAnimated ? circleOnMousePressedEventHandler : null); currentCircle.setOnMouseDragged(isAnimated ? circleOnMouseDraggedEventHandler : null); currentCircle.setOnMouseReleased( isAnimated ? circleOnMouseReleasedEventHandler : null); } } }); // computeButton computeButton.setOnAction( (value) -> { bracketField.setText(new Nussinov(sequenceField.getText()).getBracketNotation()); }); // drawButton drawButton.setOnAction( (value) -> { Graph myGraph = new Graph(); try { myGraph.parseNotation(bracketField.getText()); } catch (IOException e) { Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle(myLabels.ALERT_TITLE); alert.setHeaderText(myLabels.ALTERT_MESSAGE); alert.setContentText(bracketField.getText()); alert.showAndWait(); } coordsRepresentation[0] = SpringEmbedder.computeSpringEmbedding( iterations, myGraph.getNumberOfNodes(), myGraph.getEdges(), null); SpringEmbedder.centerCoordinates(coordsRepresentation[0], 50, 550, 50, 550); drawShapes( drawPane, coordsRepresentation[0], myGraph.getEdges(), myGraph.getNumberOfNodes()); }); // prepare scene Scene scene = new Scene(mainBox, 600, 800); primaryStage.setScene(scene); primaryStage.setTitle(myLabels.CAPTION); // show scene primaryStage.show(); }