Browse Source

Show Answers in Gui

master
Leon Montag 2 years ago
parent
commit
3357b8f71e
  1. 2
      QandA/Answers.txt
  2. 1
      QandA/Questions.txt
  3. 12
      src/main/java/game/runGame.java

2
QandA/Answers.txt

@ -0,0 +1,2 @@
187m,301m,69m,300m
erkentnisse gewinnen,zur ainsicht gelangen,eine leere ziehen,erfarungen sammeln

1
QandA/Questions.txt

@ -1 +1,2 @@
Wie hoch ist der Eifelturm? Wie hoch ist der Eifelturm?
Wurden alle Bierflaschen ausgetrunken, kann man aus dem Kasten nur noch ...?

12
src/main/java/game/runGame.java

@ -12,11 +12,17 @@ public class runGame {
public static int lines = CountFileLines(QuestionsPath); public static int lines = CountFileLines(QuestionsPath);
public static String[] arrQuestions = readFile(QuestionsPath); public static String[] arrQuestions = readFile(QuestionsPath);
public static String[] arrAnswers = readFile(AnswersPath); public static String[] arrAnswers = readFile(AnswersPath);
public static String[] splitAns;
public void run(int i) { public void run(int i) {
splitAns = SplitAnswers(arrAnswers, i);
GameGui.QuestionLabel.setText(arrQuestions[i]); GameGui.QuestionLabel.setText(arrQuestions[i]);
GameGui.AnswersBtn1.setText(splitAns[0]);
GameGui.AnswersBtn2.setText(splitAns[1]);
GameGui.AnswersBtn3.setText(splitAns[2]);
GameGui.AnswersBtn4.setText(splitAns[3]);
GameGui.questionNr++;
} }
public static int CountFileLines(String Path) { public static int CountFileLines(String Path) {
int Numlines = 0; int Numlines = 0;
@ -25,10 +31,12 @@ public class runGame {
while (reader.readLine() != null) { while (reader.readLine() != null) {
Numlines++; Numlines++;
} }
reader.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
return Numlines;
return Numlines+1;
} }

Loading…
Cancel
Save