Browse Source

Add Start Button for Tic Tac Toe Game

master
Leon Montag 2 years ago
parent
commit
e2f986b320
  1. 6
      src/main/java/Gui/StartGameGui.java
  2. 9
      src/main/java/Gui/gui.java
  3. 5
      src/main/java/game/StartTicTacToeGame.java
  4. 2
      src/test/java/Gui/guiTest.java
  5. 21
      target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  6. 10
      target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

6
src/main/java/Gui/StartGameGui.java

@ -4,6 +4,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import game.StartDarkSoulsGame;
import game.StartTicTacToeGame;
import game.runGame;
public class StartGameGui implements ActionListener {
@ -13,9 +14,12 @@ public class StartGameGui implements ActionListener {
gui.Panel.setVisible(false);
if(e.getSource() == gui.StartBtn) {
startGame();
} else {
} else if(e.getSource() == gui.StartDarkSoulsBtn) {
new StartDarkSoulsGame();
}
else if(e.getSource() == gui.StartTicTacToeBtn) {
new StartTicTacToeGame();
}
}
public void startGame() {

9
src/main/java/Gui/gui.java

@ -12,7 +12,7 @@ import javax.swing.JPanel;
public class gui implements GuiInterface {
public static JFrame Frame;
public static JButton StartBtn, CloseBtn, StartDarkSoulsBtn;
public static JButton StartBtn, CloseBtn, StartDarkSoulsBtn,StartTicTacToeBtn;
public static JPanel Panel;
public static JLabel Label;
public static int status = 0;
@ -40,6 +40,8 @@ public class gui implements GuiInterface {
StartBtn.addActionListener(new StartGameGui());
StartDarkSoulsBtn = new JButton("Starte Dark Souls 4");
StartDarkSoulsBtn.addActionListener(new StartGameGui());
StartTicTacToeBtn = new JButton("Starte Tic Tac Toe");
StartTicTacToeBtn.addActionListener(new StartGameGui());
CloseBtn = new JButton("Schliessen");
CloseBtn.addActionListener(new ActionHandler());
@ -54,14 +56,15 @@ public class gui implements GuiInterface {
gbc.gridwidth = GridBagConstraints.REMAINDER;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.ipadx = 300;
gbc.ipady = 100;
gbc.insets = new Insets(20, 0, 0, 0);
gbc.ipady = 50;
gbc.insets = new Insets(10, 0, 0, 0);
Label = new JLabel("MiniGames");
Label.setHorizontalAlignment(JLabel.CENTER);
Label.setFont(new Font("Serif", Font.BOLD, 28));
Panel.add(Label, gbc);
Panel.add(StartBtn, gbc);
Panel.add(StartDarkSoulsBtn, gbc);
Panel.add(StartTicTacToeBtn,gbc);
Panel.add(CloseBtn, gbc);
Frame.add(Panel);
Frame.setVisible(true);

5
src/main/java/game/StartTicTacToeGame.java

@ -0,0 +1,5 @@
package game;
public class StartTicTacToeGame {
}

2
src/test/java/Gui/guiTest.java

@ -42,7 +42,7 @@ class guiTest {
@Test
public void testCreatePanel() {
// arrange
int NumPanels = 4;
int NumPanels = 5;
// act
int TargetNumPanels = gui.Panel.getComponents().length;

21
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@ -1,10 +1,11 @@
C:\Users\yazan\MiniGameProject\src\main\java\game\StartDarkSoulsGame.java
C:\Users\yazan\MiniGameProject\src\main\java\game\runGame.java
C:\Users\yazan\MiniGameProject\src\main\java\Gui\gui.java
C:\Users\yazan\MiniGameProject\src\main\java\Gui\StartGameGui.java
C:\Users\yazan\MiniGameProject\src\main\java\game\loadNextQuestion.java
C:\Users\yazan\MiniGameProject\src\main\java\Gui\ActionHandler.java
C:\Users\yazan\MiniGameProject\src\main\java\Gui\GameGui.java
C:\Users\yazan\MiniGameProject\src\main\java\main.java
C:\Users\yazan\MiniGameProject\src\main\java\Gui\GameGuiInterface.java
C:\Users\yazan\MiniGameProject\src\main\java\Gui\GuiInterface.java
C:\Users\Leon\MiniGameProject\src\main\java\game\StartTicTacToeGame.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\ActionHandler.java
C:\Users\Leon\MiniGameProject\src\main\java\game\loadNextQuestion.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\GameGuiInterface.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\gui.java
C:\Users\Leon\MiniGameProject\src\main\java\game\runGame.java
C:\Users\Leon\MiniGameProject\src\main\java\game\StartDarkSoulsGame.java
C:\Users\Leon\MiniGameProject\src\main\java\main.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\StartGameGui.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\GameGui.java
C:\Users\Leon\MiniGameProject\src\main\java\Gui\GuiInterface.java

10
target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst

@ -1,5 +1,5 @@
C:\Users\yazan\MiniGameProject\src\test\java\game\loadNextQuestionTest.java
C:\Users\yazan\MiniGameProject\src\test\java\Gui\guiTest.java
C:\Users\yazan\MiniGameProject\src\test\java\Gui\GameGuiTest.java
C:\Users\yazan\MiniGameProject\src\test\java\game\runGameTest.java
C:\Users\yazan\MiniGameProject\src\test\java\Gui\ActionHandlerTest.java
C:\Users\Leon\MiniGameProject\src\test\java\Gui\guiTest.java
C:\Users\Leon\MiniGameProject\src\test\java\game\loadNextQuestionTest.java
C:\Users\Leon\MiniGameProject\src\test\java\Gui\ActionHandlerTest.java
C:\Users\Leon\MiniGameProject\src\test\java\Gui\GameGuiTest.java
C:\Users\Leon\MiniGameProject\src\test\java\game\runGameTest.java
Loading…
Cancel
Save