From 02ad893dea6a4e153b8040d5fd1c8e402ff5949f Mon Sep 17 00:00:00 2001 From: kfkama Date: Wed, 2 Feb 2022 10:29:28 +0100 Subject: [PATCH] Init Base UI --- .gitignore | 22 +++++++++ src/main/java/TicTacToe/TicTacToeGame.java | 48 +++++++++++++++++++ .../java/TicTacToe/TicTacToeGameTest.java | 10 ++++ 3 files changed, 80 insertions(+) create mode 100644 src/main/java/TicTacToe/TicTacToeGame.java create mode 100644 src/test/java/TicTacToe/TicTacToeGameTest.java diff --git a/.gitignore b/.gitignore index 84adb3f..c837958 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,25 @@ # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* + +### Maven ### +target/ +pom.xml.tag +pom.xml.releaseBackup +pom.xml.versionsBackup +pom.xml.next +release.properties +dependency-reduced-pom.xml +buildNumber.properties +.mvn/timing.properties +# https://github.com/takari/maven-wrapper#usage-without-binary-jar +.mvn/wrapper/maven-wrapper.jar + +# Eclipse m2e generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# End of https://www.toptal.com/developers/gitignore/api/maven + diff --git a/src/main/java/TicTacToe/TicTacToeGame.java b/src/main/java/TicTacToe/TicTacToeGame.java new file mode 100644 index 0000000..f958273 --- /dev/null +++ b/src/main/java/TicTacToe/TicTacToeGame.java @@ -0,0 +1,48 @@ +package TicTacToe; + +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.geom.Line2D; + +import javax.swing.JFrame; +import javax.swing.JPanel; + + +public class TicTacToeGame extends JPanel { + + private static final long serialVersionUID = 1L; + private static int width = 600, height = 600; + + public TicTacToeGame() { + this.setSize(width, height); + } + + public static void main(String[] args) { + + JFrame f = new JFrame(); + TicTacToeGame ttt = new TicTacToeGame(); + + f.add(ttt); + f.setSize(width,height); + f.setLayout(null); + f.setVisible(true); + } + + @Override + protected void paintComponent(Graphics g) { + super.paintComponent(g); + Graphics2D g2 = (Graphics2D) g; + + Line2D lin = new Line2D.Float(250, 150, 250, 450); + Line2D lin2 = new Line2D.Float(350, 150, 350, 450); + Line2D lin3 = new Line2D.Float(150, 250, 450, 250); + Line2D lin4 = new Line2D.Float(150, 350, 450, 350); + + g2.draw(lin); + g2.draw(lin2); + g2.draw(lin3); + g2.draw(lin4); + } + + +} \ No newline at end of file diff --git a/src/test/java/TicTacToe/TicTacToeGameTest.java b/src/test/java/TicTacToe/TicTacToeGameTest.java new file mode 100644 index 0000000..08742dd --- /dev/null +++ b/src/test/java/TicTacToe/TicTacToeGameTest.java @@ -0,0 +1,10 @@ +package TicTacToe; + +import static org.junit.jupiter.api.Assertions.*; +import org.junit.jupiter.api.Test; + +class TicTacToeGameTest { + + + +}