Newer
Older
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
public class TicTacToeFX extends Application {
@Override
public void start(Stage primaryStage) {
// Erstelle das GridPane für das Spielfeld
GridPane grid = new GridPane();
// 3x3 Buttons hinzufügen
for (int row = 0; row < 3; row++) {
for (int col = 0; col < 3; col++) {
Button button = new Button();
button.setPrefSize(100, 100); // Größe der Buttons
grid.add(button, col, row); // Hinzufügen zum Grid
}
}
// Szene und Stage erstellen
Scene scene = new Scene(grid, 300, 300); // Größe der Szene
primaryStage.setTitle("Tic-Tac-Toe");
primaryStage.setScene(scene);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}