Пример #1
0
  public void appear(final CardGui card) {
    moving = card;
    player1.animations.add(moving);
    Thread t =
        new Thread(
            () -> {
              moving.setBounds(925 - 62, 609 - 93, 0, 0);
              int i = 0, j = 0;
              while (i <= 124 || j <= 186) {
                try {
                  if (i <= 124) {
                    i++;
                    moving.setBounds(925 - 62, 609 - 93, i, j);
                    Thread.sleep(1);
                  }
                  if (j <= 186) {
                    j++;
                    moving.setBounds(925 - 62, 609 - 93, i, j);

                    Thread.sleep(1);
                  }
                } catch (InterruptedException e) {
                  e.printStackTrace();
                }
              }
              i = 925 - 62;

              while (i >= 652) {
                i--;
                try {
                  Thread.sleep(1);
                } catch (InterruptedException e) {
                  e.printStackTrace();
                }
                moving.setLocation(i, 609 - 93);
              }

              player1.animations.remove(moving);
              player1.repairListeners(false);
              PlayGui.player.pdeck.textField.setText(
                  "cards left " + PlayGui.player.pdeck.Deck.cardsLeft());
              player1.cardDrawn = 1;
              PlayGui.player.pdeck.textField.repaint();
              setVisible(true);
              repaint();
            });
    t.start();
  }