Browse Source

refactoring: Formating Code

master
Leon Montag 2 years ago
parent
commit
3e6c043e22
  1. 1
      src/main/java/Gui/ActionHandler.java
  2. 2
      src/main/java/Gui/StartGameGui.java
  3. 4
      src/main/java/Gui/gui.java
  4. 4
      src/main/java/game/runGame.java
  5. 3
      src/test/java/Gui/guiTest.java
  6. 3
      src/test/java/game/runGameTest.java
  7. 2
      target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

1
src/main/java/Gui/ActionHandler.java

@ -3,7 +3,6 @@ package Gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class ActionHandler implements ActionListener {
public void actionPerformed(ActionEvent e) {

2
src/main/java/Gui/StartGameGui.java

@ -5,7 +5,6 @@ import java.awt.event.ActionListener;
import game.runGame;
public class StartGameGui implements ActionListener {
@Override
@ -13,6 +12,7 @@ public class StartGameGui implements ActionListener {
gui.Panel.setVisible(false);
startGame();
}
public void startGame() {
GameGuiInterface Gui = new GameGui();
Gui.createGui();

4
src/main/java/Gui/gui.java

@ -23,6 +23,7 @@ public class gui implements GuiInterface {
createButtons();
createPanel();
}
@Override
public void createFrame() {
Frame = new JFrame("MiniGames");
@ -39,8 +40,8 @@ public class gui implements GuiInterface {
CloseBtn = new JButton("Schließen");
CloseBtn.addActionListener(new ActionHandler());
}
@Override
public void createPanel() {
Panel = new JPanel();
@ -63,5 +64,4 @@ public class gui implements GuiInterface {
Panel.setVisible(true);
}
}

4
src/main/java/game/runGame.java

@ -14,7 +14,6 @@ public class runGame {
public static String[] arrAnswers = readFile(AnswersPath);
public static String[] splitAns;
public void run(int i) {
splitAns = SplitAnswers(arrAnswers, i);
GameGui.QuestionLabel.setText(arrQuestions[i]);
@ -24,6 +23,7 @@ public class runGame {
GameGui.AnswersBtn4.setText(splitAns[3]);
GameGui.questionNr++;
}
public static int CountFileLines(String Path) {
int Numlines = 0;
try {
@ -39,6 +39,7 @@ public class runGame {
return Numlines + 1;
}
public static String[] readFile(String Path) {
BufferedReader reader;
String[] Arr = new String[lines];
@ -57,6 +58,7 @@ public class runGame {
}
return Arr;
}
public static String[] SplitAnswers(String[] data2, int i) {
String[] parts = data2[i].split(",");
return parts;

3
src/test/java/Gui/guiTest.java

@ -22,6 +22,7 @@ class guiTest {
assertEquals(FrameWitdh, gui.Frame.getWidth());
assertEquals(FrameHeight, gui.Frame.getHeight());
}
@Test
public void testCreateButtons() {
// arrange
@ -49,6 +50,4 @@ class guiTest {
assertEquals(NumPanels, TargetNumPanels);
}
}

3
src/test/java/game/runGameTest.java

@ -56,8 +56,8 @@ class runGameTest {
e.printStackTrace();
}
}
@Test
public void testSplitAnswers() {
String[] StringToSplit = { "Das,ist,ein,Test", "1,2,3,4" };
@ -69,5 +69,4 @@ class runGameTest {
assertEquals("4", parts[3]);
}
}

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

@ -1,6 +1,8 @@
C:\Users\Leon\MiniGameProject\src\main\java\Gui\ActionHandler.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\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
Loading…
Cancel
Save