Browse Source

Init Base UI

feature_TicTacToe_BaseUI
kfkama 2 years ago
parent
commit
02ad893dea
  1. 22
      .gitignore
  2. 48
      src/main/java/TicTacToe/TicTacToeGame.java
  3. 10
      src/test/java/TicTacToe/TicTacToeGameTest.java

22
.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

48
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);
}
}

10
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 {
}
Loading…
Cancel
Save