Skip to content
Snippets Groups Projects
Commit 79b4a3a1 authored by Jan Peter Schweers's avatar Jan Peter Schweers
Browse files

Merge branch 'BasicTicTacToe' into 'develop'

Merge TicTacToc basics into develop

See merge request !4
parents 186ee01b 3cec09c6
No related branches found
No related tags found
2 merge requests!6Add final version of the game to main branch,!4Merge TicTacToc basics into develop
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
package com.example.tictactoe_game;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class HelloApplication extends Application {
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(HelloApplication.class.getResource("hello-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 320, 240);
stage.setTitle("Hello!");
stage.setScene(scene);
stage.show();
}
public static void main(String[] args) {
launch();
}
}
\ No newline at end of file
package com.example.tictactoe_game;
import javafx.fxml.FXML;
import javafx.scene.control.Label;
public class HelloController {
@FXML
private Label welcomeText;
@FXML
protected void onHelloButtonClick() {
welcomeText.setText("Welcome to JavaFX Application!");
}
}
\ No newline at end of file
package com.example.tictactoe_game;
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 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);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Button?>
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"
fx:controller="com.example.tictactoe_game.HelloController">
<padding>
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/>
</padding>
<Label fx:id="welcomeText"/>
<Button text="Hello!" onAction="#onHelloButtonClick"/>
</VBox>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment