|
@ -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; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|