import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;

public class TranslationDemo extends Application {
  @Override // Przesłanianie metody start z klasy Application
  public void start(Stage primaryStage) {   
    Pane pane = new Pane();

    double x = 10; 
    double y = 10;
    java.util.Random random = new java.util.Random();
    for (int i = 0; i < 10; i++) {
      Rectangle rectangle = new Rectangle(10, 10, 50, 60);  
      rectangle.setFill(Color.WHITE);
      rectangle.setStroke(Color.color(random.nextDouble(), 
        random.nextDouble(), random.nextDouble()));
      rectangle.setTranslateX(x += 20);
      rectangle.setTranslateY(y += 5);
      pane.getChildren().add(rectangle);
    }

    Scene scene = new Scene(pane, 300, 250);           
    primaryStage.setTitle("TranslationDemo"); // Ustawianie nagłówka okna
    primaryStage.setScene(scene); // Umieszczanie sceny w oknie
    primaryStage.show(); // Wyświetlanie okna
  }

  // Uruchom program w wierszu poleceń
  public static void main(String[] args) {
    launch(args);
  }
}


