|
@ -4,25 +4,31 @@ import java.io.BufferedReader; |
|
|
import java.io.FileReader; |
|
|
import java.io.FileReader; |
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
|
|
|
|
import Gui.GameGui; |
|
|
|
|
|
|
|
|
public class runGame { |
|
|
public class runGame { |
|
|
public static String QuestionsPath = "QandA/Questions.txt"; |
|
|
public static String QuestionsPath = "QandA/Questions.txt"; |
|
|
public static String AnswersPath = "QandA/Answers.txt"; |
|
|
public static String AnswersPath = "QandA/Answers.txt"; |
|
|
public static int lines; |
|
|
|
|
|
|
|
|
public static int lines = CountFileLines(QuestionsPath); |
|
|
|
|
|
public static String[] arrQuestions = readFile(QuestionsPath); |
|
|
|
|
|
public static String[] arrAnswers = readFile(AnswersPath); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void run() { |
|
|
|
|
|
CountFileLines(QuestionsPath); |
|
|
|
|
|
readFile(QuestionsPath); |
|
|
|
|
|
|
|
|
public void run(int i) { |
|
|
|
|
|
GameGui.QuestionLabel.setText(arrQuestions[i]); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
public int CountFileLines(String Path) { |
|
|
|
|
|
|
|
|
public static int CountFileLines(String Path) { |
|
|
|
|
|
int Numlines = 0; |
|
|
try { |
|
|
try { |
|
|
BufferedReader reader = new BufferedReader(new FileReader(Path)); |
|
|
BufferedReader reader = new BufferedReader(new FileReader(Path)); |
|
|
while (reader.readLine() != null) { |
|
|
while (reader.readLine() != null) { |
|
|
lines++; |
|
|
|
|
|
|
|
|
Numlines++; |
|
|
} |
|
|
} |
|
|
} catch (IOException e) { |
|
|
} catch (IOException e) { |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
} |
|
|
} |
|
|
return lines; |
|
|
|
|
|
|
|
|
return Numlines; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|