예제 #1
1
  private void playAudio(Media media) {
    if (mediaView.isVisible() == true) {
      mediaView.setVisible(false);
      display.setVisible(true);
    }
    if (mp != null) {
      mp.dispose();
    }

    mp = new MediaPlayer(media);
    mp.play();

    mp.setAudioSpectrumListener(
        (double timestamp, double duration1, float[] magnitudes, float[] phases) -> {
          display.getChildren().clear();
          int i = 0;
          int x = 10;
          double y = root.getScene().getHeight() / 2;
          Random rand = new Random(System.currentTimeMillis());
          for (float phase : phases) {
            int red = rand.nextInt(255);
            int green = rand.nextInt(255);
            int blue = rand.nextInt(255);
            Circle circle = new Circle(10);
            circle.setCenterX(x + i);
            circle.setCenterY(y + (phase * 100));
            circle.setFill(Color.rgb(red, green, blue, .70));
            display.getChildren().add(circle);
            i += 10;
          }
        });
  }
  /** *********************************************** */
  public void init() {
    mvl = new Line(0, 0, 0, h);
    mvl.setStrokeWidth(1);
    mvl.setStroke(Color.RED);
    mhl = new Line(0, 0, w, 0);
    mhl.setStrokeWidth(1);
    mhl.setStroke(Color.BLUE);
    TargetPoint = new Circle(5);
    TargetPoint.setFill(Color.CADETBLUE);
    drawPane.getChildren().add(TargetPoint);

    Line vl = new Line(w / 2, 0, w / 2, h);
    vl.setStrokeWidth(0.2);
    Line hl = new Line(0, h / 2, w, h / 2);
    vl.setStrokeWidth(0.2);
    robot = new robot(35, 45);
    robot.setSpeed(0);
    robot.get().setFill(Color.BROWN);
    robot.get().setStroke(Color.BLACK);
    robot.setTranslateX((w - 35) / 2);
    robot.setTranslateY(h - 90);
    drawPane.getChildren().addAll(mhl, mvl, hl, vl, robot);
    Algorithm.setRobot(robot);
    Algorithm.setSpeed(0);
    Static.RoboTC = RoboTC;
    Static.RobotS = RobotS;
    Static.RobotR = RobotR;
    Static.SensorDR = SensorDR;
    Static.SensorDL = SensorDL;
  }
  public DrawerLayout() {
    AnchorPane.setTopAnchor(toggleLayer, 0d);
    AnchorPane.setRightAnchor(toggleLayer, 0d);
    AnchorPane.setBottomAnchor(toggleLayer, 0d);
    AnchorPane.setLeftAnchor(toggleLayer, 0d);
    toggleLayer.setBackground(
        new Background(new BackgroundFill(Color.BLACK, new CornerRadii(0d), new Insets(0))));
    toggleLayer.setOpacity(0);
    toggleLayer.setVisible(false);

    toggleLayer.setOnMouseClicked(
        evt -> {
          if (evt.getButton().equals(MouseButton.PRIMARY)) {
            if (drawerOpened) {
              closeDrawer();
            }
          }
        });

    tableScreen.bind(widthProperty().lessThan(responsiveWidth).or(responsiveWidth.isEqualTo(0)));
    tableScreen.addListener(
        (observable, oldValue, newValue) -> {
          responsiveBehavior(newValue);
        });
  }
  private void addWorkflowAnimation(String workflowClass, String workflowInstanceId, long time) {
    Optional<AnimationPartBase> animationOpt =
        searchAnimationRunningAt(workflowInstanceId, time, time + DEFAULT_TOTAL_ANNIMATION_TIME);
    if (animationOpt.isPresent()) {
      animationOpt.get().endTime = time + DEFAULT_TOTAL_ANNIMATION_TIME;
    } else {
      Optional<Double> ypos =
          getFreeYslot(
              time,
              time + DEFAULT_TOTAL_ANNIMATION_TIME,
              EventAnimationBase.EVENT_HEIGHT + 15 + 35,
              false,
              Arrays.<Class<? extends AnimationPartBase>>asList(WorkflowAnimation.class));
      if (ypos.isPresent()) {
        double xpos =
            animationPane.getWidth() / 2
                - animationPane.getWidth() / 4
                - WorkflowAnimation.WIDTH / 2;

        animations.add(
            new WorkflowAnimation(
                workflowClass,
                new AnimationPartParameter(
                    time,
                    time + DEFAULT_TOTAL_ANNIMATION_TIME,
                    workflowInstanceId,
                    xpos,
                    ypos.get(),
                    xpos,
                    ypos.get())));
      }
    }
  }
  @Override
  public void start(Stage primaryStage) {
    Pane p = new Pane();
    for (int i = 0; i < 5; i++) {
      Button b = new Button("pm" + i);
      b.setLayoutX(i * 40);
      b.setLayoutY(i * 20);
      p.getChildren().add(b);
    }
    Scene s = new Scene(p);
    primaryStage.setScene(s);
    primaryStage.setTitle("Gauche à droite");
    primaryStage.setX(0);
    primaryStage.setY(0);
    primaryStage.show();

    Stage st = new Stage();
    Pane pt = new Pane();
    for (int i = 0; i < 5; i++) {
      Button b = new Button("s" + i);
      b.setLayoutX((4 - i) * 40);
      b.setLayoutY(i * 20);
      pt.getChildren().add(b);
    }
    Scene t = new Scene(pt);
    st.setScene(t);
    st.setTitle("Droite à gauche");
    st.setX(400);
    st.setY(400);

    st.show();
  }
예제 #6
0
  @Override
  public void start(Stage primaryStage) throws Exception {

    // Added 52 integers to array
    for (int i = 1; i <= 52; ++i) arr.add(i);

    // Shuffle the Array
    Collections.shuffle(arr);

    // Create three image objects
    Image card1 = new Image("images/card/" + arr.get(0) + ".png");
    Image card2 = new Image("images/card/" + arr.get(1) + ".png");
    Image card3 = new Image("images/card/" + arr.get(2) + ".png");

    // Add images to imageView objects
    ImageView card1View = new ImageView(card1);
    ImageView card2View = new ImageView(card2);
    ImageView card3View = new ImageView(card3);

    // Add them to the pane
    Pane pane = new HBox();
    pane.getChildren().add(card1View);
    pane.getChildren().add(card2View);
    pane.getChildren().add(card3View);

    Scene scene = new Scene(pane);
    primaryStage.setTitle("Ex4_3");
    primaryStage.setScene(scene);
    primaryStage.show();
  }
예제 #7
0
파일: Grid.java 프로젝트: suxue/tetris
  public Grid(final int rowNo, final int columnNo, final Pane container) {
    super();
    this.container = container;

    this.columnNumber = columnNo;
    this.rowNumber = rowNo;

    container
        .widthProperty()
        .addListener(
            new ChangeListener<Number>() {

              public void changed(
                  ObservableValue<? extends Number> observableValue,
                  Number number,
                  Number widthNo) {
                recalculateMinoSize();
              }
            });

    container
        .heightProperty()
        .addListener(
            new ChangeListener<Number>() {

              public void changed(
                  ObservableValue<? extends Number> observableValue,
                  Number number,
                  Number heightNo) {
                recalculateMinoSize();
              }
            });

    recalculateMinoSize();
  }
예제 #8
0
 /** Writes the newest guest to the guesses pane for GUI */
 private void writeGuess() {
   // TODO Auto-generated method stub
   GuessSet lastGuess = Main.initBoard.guesses.get(Main.initBoard.guesses.size() - 1);
   int rowHeight = 66 * (Main.initBoard.guesses.size() - 1);
   int pinOffset = 320;
   // int circleWidth = 50;
   for (int i = 0; i < 4; i++) {
     Circle temp = new Circle(40 + 75 * i, rowHeight + 35, 30);
     temp.setFill(returnColor(lastGuess.pieceSet.get(i)));
     guesses.getChildren().add(temp);
   }
   for (int i = 0; i < (lastGuess.whitePins + lastGuess.blackPins); i++) {
     Color pinColor = Color.WHITE;
     int verticleOffset = 0;
     if (i >= lastGuess.whitePins) {
       pinColor = Color.BLACK;
     }
     if ((i / 2) > 0) {
       verticleOffset = 1;
     }
     Circle temp = new Circle(pinOffset + 20 * (i % 2), rowHeight + 25 + 20 * verticleOffset, 7);
     temp.setFill(pinColor);
     temp.setStroke(Color.BLACK);
     guesses.getChildren().add(temp);
   }
 }
  private void updateIdentity() {
    Identity identity = clientConfiguration.getSelectedIdentity();

    browseNav.setManaged(identity != null);
    contactsNav.setManaged(identity != null);
    syncNav.setManaged(identity != null);
    // inviteNav.setManaged(identity != null);
    selectedIdentity.setVisible(identity != null);
    // feebbackNav.setVisible(identity != null);

    avatarContainer.setVisible(identity != null);
    if (identity == null) {
      return;
    }

    final String currentAlias = identity.getAlias();
    if (currentAlias.equals(lastAlias)) {
      return;
    }

    new AvatarView(e -> currentAlias).getViewAsync(avatarContainer.getChildren()::setAll);
    alias.setText(currentAlias);
    lastAlias = currentAlias;

    if (clientConfiguration.getAccount() == null) {
      return;
    }
    mail.setText(clientConfiguration.getAccount().getUser());
  }
예제 #10
0
  private void PaintCircle1() { // здесь прорисовка точек
    int X1 = 20;
    int Y1 = 20;
    for (int i = 0; i < Main.LINE; i++) {
      for (int j = 0; j < Main.COLUMN; j++) {
        int x1 = X1 + i * 40;
        int y1 = Y1 + j * 40;

        if (Field[j][i] == 1) {
          Circle c1 = new Circle(x1, y1, 20, Color.BLUE); // + на экран

          layout.getChildren().add(c1);
        }
        if (Field[j][i] == 2) {
          Circle c2 = new Circle(x1, y1, 20, Color.RED); // + на экран

          layout.getChildren().add(c2);
        }
        if (Field[j][i] == 6) {
          Circle c3 = new Circle(x1, y1, 20, Color.BLACK); // + на экран

          layout.getChildren().add(c3);
        }
        if (Field[j][i] == 7) {
          Circle c4 = new Circle(x1, y1, 20, Color.BLACK); // + на экран

          layout.getChildren().add(c4);
        }
        Y1 += 1;
      }
      X1 += 1;
      Y1 = 20;
    }
  }
 @Override
 public void initialize(URL location, ResourceBundle resources) {
   this.resources = resources;
   this.merchantService = new MerchantService();
   cancelButton.setOnMouseClicked(event -> handleCancelButton());
   submitButton.setOnMouseClicked(event -> handleSubmitButton());
 }
예제 #12
0
  public FXDialog() {
    // Setup general stage and main grid
    msgLabel = detLabel = null;
    stage = new Stage();
    stage.initModality(Modality.WINDOW_MODAL);
    grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(10, 10, 10, 10));

    // Add the OK button (it's a default)
    buttonArea = new HBox(10);
    Button okBtn = new Button("OK");
    okBtn.setOnAction(
        event -> {
          okPressed = true;
          stage.hide();
        });
    buttonArea.getChildren().add(okBtn);
    grid.add(buttonArea, 1, 2);

    // ImageView imageView = new ImageView();
    // grid.add(imageView, 0, 0);

    // Add a 50 width pane for spacing and also as we plan on adding an image at 0,0
    // some time in the future
    Pane pane = new Pane();
    pane.setMinWidth(50);
    grid.add(pane, 0, 1);

    stage.setScene(new Scene(grid, 250, 100));
    okPressed = false;
  }
예제 #13
0
  public RNADrawingView() {

    // set up gui
    drawingPane.setPrefWidth(400);
    drawingPane.setPrefHeight(400);
    warningLabel.setTextFill(Color.RED);
    animateCheckbox.setSelected(false);

    buttonBox.getChildren().addAll(foldButton, drawButton, animateCheckbox);
    inputBox.getChildren().addAll(sequenceField, bracketField, buttonBox);
    buttonInputBox.getChildren().addAll(inputBox, warningLabel, buttonBox);
    drawingPane.getChildren().add(drawing);
    root.setTop(buttonInputBox);
    root.setBottom(drawingPane);

    buttonBox.setAlignment(Pos.BOTTOM_LEFT);
    inputBox.setPadding(new Insets(10, 5, 10, 5));
    HBox.setMargin(foldButton, new Insets(0, 2.5, 0, 2.5));
    HBox.setMargin(drawButton, new Insets(0, 2.5, 0, 2.5));
    HBox.setMargin(animateCheckbox, new Insets(0, 2.5, 0, 2.5));
    VBox.setMargin(sequenceField, new Insets(0, 0, 5, 0));

    this.scene = new Scene(root);
    scene.getStylesheets().add("resources/assignment6and7.css");
    drawingPane.getStyleClass().add("drawingPane");
  }
예제 #14
0
  public static void startValueSetAnimation(final Pane parent) {
    final javafx.scene.shape.Rectangle rectangle = new javafx.scene.shape.Rectangle();
    Insets margin = BorderPane.getMargin(parent);
    if (margin == null) {
      margin = new Insets(0);
    }
    rectangle
        .widthProperty()
        .bind(parent.widthProperty().subtract(margin.getLeft() + margin.getRight()));
    rectangle
        .heightProperty()
        .bind(parent.heightProperty().subtract(margin.getTop() + margin.getBottom()));
    rectangle.setFill(Color.rgb(0, 150, 201));
    parent.getChildren().add(rectangle);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(5);
    bb.setHeight(5);
    bb.setIterations(3);
    rectangle.setEffect(bb);

    FadeTransition ft = new FadeTransition(Duration.millis(250), rectangle);
    ft.setFromValue(0.2);
    ft.setToValue(0.8);
    ft.setCycleCount(2);
    ft.setAutoReverse(true);
    ft.play();
    ft.setOnFinished(
        new EventHandler<ActionEvent>() {
          @Override
          public void handle(ActionEvent event) {
            parent.getChildren().remove(rectangle);
          }
        });
  }
예제 #15
0
 /**
  * @param event Triggered on click of delete button next to inputBox
  *     <p>Utilized to remove the last entered item in the inputBox
  */
 public void deleteGuess(ActionEvent event) {
   if (inputBox.getChildren().size() < 1) {
     return;
   }
   Circle temp = (Circle) inputBox.getChildren().remove(inputBox.getChildren().size() - 1);
   temp.setFill(Color.WHITE);
   Main.initBoard.currentGuess.removePiece(inputBox.getChildren().size());
 }
 public GridPositionCalc build() {
   int width = (int) ((gridView.getPrefHeight()));
   int x = (int) ((gridView.getPrefWidth() / 2) - width / 2);
   initRect(width, x);
   initLabels(width, x);
   initLabelText(x, width);
   return new GridPositionCalc(x, paddingTop, width);
 }
예제 #17
0
 public Pane getCSSStyledPane() {
   Pane p = new Pane();
   p.setPrefSize(100, 50);
   p.setStyle(
       "-fx-background-color: lightgray, red;"
           + "-fx-background-insets: 0, 4;"
           + "-fx-background-radius: 4, 2;");
   return p;
 }
 private void drawPanelForTopHeader() {
   Pane panel = new Pane();
   panel.setId("panelForTopheader");
   panel.setPrefSize(722, 382);
   panel.setLayoutX(-1);
   panel.setLayoutY(63);
   this.addToStep(panel);
   this.contentPanel = panel;
 }
  @Override
  public void initialize(URL location, ResourceBundle resources) {
    // TODO Auto-generated method stub
    w = drawPane.getPrefWidth();
    h = drawPane.getPrefHeight();

    Algorithm = new Algorithm(w, h);
    init();
    loop();
    event();
  }
예제 #20
0
  public void start(Stage primaryStage) {

    // Creates the pane and font objects to be used, as well as a string for the chars.
    Pane paneOne = new Pane();
    Font mainFont = Font.font("Times New Roman", FontWeight.BOLD, FontPosture.REGULAR, 35);
    String text = "Welcome to Java ";

    // Makes a point in the very center of the 600x600 scene, a double for distance
    // from the center, and one for the starting rotation of the first character.
    double centerX = 300;
    double centerY = 300;
    double distance = 200;
    double rotation = 90;

    for (int i = 0; i < text.length(); i++) {
      /**
       * To make the positions work correctly, I treat the characters as elements on a unit circle.
       * I find the angle by multiplying 2 * pi by i, then dividing that by the length of the text.
       * Next, I find the A. cos and B. sin of the angle, and multiply that by the distance from the
       * center to find the change in X and Y respectively. Finally, the X and Y for the current
       * character are found by adding the change in X and Y to the center X and Y.
       */
      double unitCircleAngle = (2 * Math.PI * i) / text.length();
      double deltaX = distance * Math.cos(unitCircleAngle);
      double deltaY = distance * Math.sin(unitCircleAngle);
      double currentX = centerX + deltaX;
      double currentY = centerY + deltaY;

      // I make a string of the char at index i by finding the charAt, then using the
      // Character.toString
      // method to cast it a string; then I make a Text object using the current X and Y and the
      // current
      // character. I set the font, and current rotation of the character. Finally, I add 22.5 to
      // the rotation
      // to ensure that it is at the appropriate rotation for the next character.
      String tempChar = Character.toString(text.charAt(i));
      ;
      Text tempText = new Text(currentX, currentY, tempChar);

      tempText.setFont(mainFont);
      tempText.setRotate(rotation);

      paneOne.getChildren().add(tempText);
      rotation = rotation + 22.5;
    }

    // I make a scene of the appropriate size using the pane with the characters, set the stage
    // title, add the
    // scene to the stage, and show it.
    Scene sceneOne = new Scene(paneOne, 600, 600);
    primaryStage.setTitle("Characters Around A Circle");
    primaryStage.setScene(sceneOne);
    primaryStage.show();
  }
예제 #21
0
파일: Main.java 프로젝트: hikarido/javaCode
  @Override
  public void start(Stage primaryStage) throws Exception {
    Pane lay = new Pane();
    Scene scene = new Scene(lay);

    Properties p = new Properties();

    lay.getChildren().add(p);

    primaryStage.setScene(scene);
    primaryStage.show();
  }
 private Node wrapAndStyle(Region node, int rowNumber) {
   Pane p = new Pane(node);
   node.setPadding(new Insets(5.0));
   GridPane.setFillWidth(p, true);
   p.minHeightProperty().bind(node.heightProperty());
   // Hack - wrapped labels don't seem to fire their height property changes at the right time -
   // leaving the surrounding Pane node too small.
   // this seems to help...
   Platform.runLater(() -> p.autosize());
   p.getStyleClass().add(((rowNumber % 2 == 0) ? "evenGridRow" : "oddGridRow"));
   return p;
 }
예제 #23
0
  public void setMode(Mode mode) {
    if (mode != this.mode) {
      Mode previousMode = this.mode;
      this.mode = mode;
      log.info(String.format("Dock mode is now %s", mode));
      switch (mode) {
        case LAUNCHERS:
          rebuildIcons();
          setAvailable();
          flinger.recentre();
          break;
        case UPDATE:
          try {
            // Starting an update, so hide the all other windows
            hideIfShowing(signInPopup);
            hideIfShowing(optionsPopup);
            hideIfShowing(resourceGroupPopup);
            setAvailable();
            updateScene =
                (Update)
                    context.openScene(
                        Update.class, Configuration.getDefault().isVertical() ? "Vertical" : null);
            Scene scn = updateScene.getScene();
            scn.setFill(new Color(0, 0, 0, 0));

            /*
             * The update popup will get future update events, but it
             * needs this one to initialize
             */
            updateScene.initUpdate(appsToUpdate, previousMode);

            Parent sceneRoot = scn.rootProperty().get();
            scn.setRoot(new Group());

            if (cfg.isVertical())
              ((VBox) sceneRoot).minWidthProperty().bind(shortcuts.heightProperty());
            else ((HBox) sceneRoot).minHeightProperty().bind(shortcuts.widthProperty());

            flinger.getContent().getChildren().clear();
            flinger.getContent().getChildren().add(sceneRoot);
          } catch (IOException ioe) {
            log.error("Failed to load update scene.", ioe);
          }
          break;
        case IDLE:
          flinger.getContent().getChildren().clear();
          setAvailable();
          break;
        default:
          throw new UnsupportedOperationException();
      }
    }
  }
예제 #24
0
 /** Add black pin to both the screen area and to the last guess */
 public void addBlackPin() {
   if (pinInput.getChildren().size() > 3) {
     return;
   }
   GuessSet currentGuess = Main.initBoard.guesses.get(Main.initBoard.guesses.size() - 1);
   currentGuess.blackPins++;
   int numPins = pinInput.getChildren().size();
   Circle newCircle = new Circle(20 + 40 * (numPins % 2), 20 + (40 * (numPins / 2)), 14);
   newCircle.setFill(Color.BLACK);
   newCircle.setStroke(Color.BLACK);
   pinInput.getChildren().add(newCircle);
 }
예제 #25
0
 /** Resets initBoard, all panes with Circles, and text */
 public void reset() {
   Random randoInt = Main.randoInt;
   ArrayList<pieceType> initSolution =
       Board.generateSolution(
           randoInt.nextInt(4), randoInt.nextInt(4), randoInt.nextInt(4), randoInt.nextInt(4));
   Main.initBoard = new Board(initSolution);
   guesses.getChildren().clear();
   inputBox.getChildren().clear();
   winLose.setText("");
   guessSet.setDisable(false);
   Main.allGuesses.clear();
   Main.generateAllGuesses(Main.allGuesses);
 }
 private Parent getContent() {
   // instantiate the table with null items
   TableView<String> view = new TableView<String>(null);
   TableColumn<String, String> column = new TableColumn<>("Items");
   // either click on header for sorting
   view.getColumns().addAll(column);
   // or add column to sort order immediately
   // view.getSortOrder().add(column);
   Pane parent = new HBox(100);
   parent.getChildren().addAll(view);
   parent.setPadding(new Insets(20));
   return parent;
 }
예제 #27
0
 /**
  * @param event Triggered by delete button next to pin input
  *     <p>Removes the last circle and pin from guesses
  */
 public void deletePin(ActionEvent event) {
   if (pinInput.getChildren().size() < 1) {
     return;
   }
   Circle temp = (Circle) pinInput.getChildren().get(pinInput.getChildren().size() - 1);
   GuessSet currentGuess = Main.initBoard.guesses.get(Main.initBoard.guesses.size() - 1);
   if (temp.getFill() == Color.BLACK) {
     currentGuess.blackPins--;
   } else if (temp.getFill() == Color.WHITE) {
     currentGuess.whitePins--;
   }
   pinInput.getChildren().remove(pinInput.getChildren().size() - 1);
 }
 private void responsiveBehavior(boolean tabletScreen) {
   if (content != null && nav != null) {
     if (tabletScreen) {
       AnchorPane.setLeftAnchor(content, 0d);
       nav.setTranslateX(-DEFAULT_WIDTH_NAV);
     } else {
       AnchorPane.setLeftAnchor(content, DEFAULT_WIDTH_NAV);
       nav.setTranslateX(0);
       toggleLayer.setVisible(false);
       drawerOpened = false;
     }
   }
 }
  public SimpleScrollableVisualScene(double contentPrefWidth, double contentPrefHeight) {
    this.rotationProperty = new SimpleDoubleProperty(0);
    this.scaleProperty = new SimpleDoubleProperty(1);

    this.layers = new HashMap<>();
    this.entities = new HashMap<>();

    pane = new Pane();
    pane.setPrefWidth(contentPrefWidth);
    pane.setPrefHeight(contentPrefHeight);
    setContent(pane);

    setHbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS);
  }
예제 #30
0
파일: AEXBanner.java 프로젝트: mrhaver/GSO
  @Override
  public void start(Stage primaryStage) throws RemoteException {

    controller = new BannerController(this);
    Font font = new Font("Arial", HEIGHT);
    text = new Text();
    text.setFont(font);
    text.setFill(Color.BLACK);

    Pane root = new Pane();
    root.getChildren().add(text);
    Scene scene = new Scene(root, WIDTH, HEIGHT);

    primaryStage.setTitle("AEX banner");
    primaryStage.setScene(scene);
    primaryStage.show();
    primaryStage.toFront();

    // Start animation: text moves from right to left
    animationTimer =
        new AnimationTimer() {
          private long prevUpdate;

          @Override
          public void handle(long now) {
            long lag = now - prevUpdate;
            if (lag >= NANO_TICKS) {
              // calculate new location of text
              // TODO

              textPosition = textPosition - 8;
              if (textPosition < -textLength) {
                textPosition = WIDTH;
              }

              text.relocate(textPosition, 0);
              prevUpdate = now;
            }
          }

          @Override
          public void start() {
            prevUpdate = System.nanoTime();
            textPosition = WIDTH;
            text.relocate(textPosition, 0);
            super.start();
          }
        };
    animationTimer.start();
  }