import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.Pane; import javafx.scene.layout.GridPane; import javafx.scene.text.Font; import javafx.scene.text.Text; import javafx.geometry.Insets; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.scene.shape.Rectangle; public class Rutenett extends Application { @Override public void start(Stage teater) { GridPane rutenett = new GridPane(); //rutenett.setGridLinesVisible(true); //rutenett.setPadding(new Insets(5.0)); //rutenett.setStyle("-fx-background-color: skyblue;"); int teller = 1; for (int rad = 0; rad < 2; rad++){ for (int kol = 0; kol < 3; kol++) { Text tekst = new Text(" "+ teller + " "); tekst.setFont(new Font(70)); Rectangle rek = new Rectangle(100, 100, Color.SKYBLUE); rek.setStroke(Color.BLACK); StackPane celle = new StackPane(); celle.getChildren().addAll(rek, tekst); rutenett.add(celle, kol, rad); //rutenett.add(tekst, kol, rad); teller++; } } Scene scene = new Scene(rutenett); teater.setTitle("Oppgave 1"); teater.setScene(scene); teater.show(); } public static void main(String[] args) { Application.launch(args); } }