import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.text.Text; import javafx.scene.text.Font; import javafx.scene.layout.Pane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.scene.layout.GridPane; import javafx.scene.layout.StackPane; import javafx.scene.shape.Rectangle; public class Tall extends Application { @Override public void start(Stage stage) { GridPane root = new GridPane(); int teller = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { teller++; Rectangle rect = new Rectangle(40, 40, Color.SKYBLUE); rect.setStroke(Color.BLACK); Text text = new Text(teller + ""); text.setFont(new Font(30)); StackPane sp = new StackPane(rect, text); root.add(sp, j, i); } } Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("V?rt program"); stage.show(); } }