FaultInOurPong
1
|
Public Member Functions | |
HighScore () throws IOException | |
Constructor for the HighScore. More... | |
void | checkHighScore (double nameScore, JFrame main) throws IOException |
checks the high score and update the score file More... | |
Static Public Member Functions | |
static void | readFrom () throws IOException |
reads score data. More... | |
static void | writeTo () |
writes the score onto the file More... | |
static boolean | isHigh (double nameScored) |
checks whether the score can be in top 20 list More... | |
static int | findRank () throws IOException |
determines the rank of a score More... | |
static void | highScorePage (JFrame main) throws IOException |
displays the high score More... | |
view.HighScore.HighScore | ( | ) | throws IOException |
void view.HighScore.checkHighScore | ( | double | nameScore, |
JFrame | main | ||
) | throws IOException |
checks the high score and update the score file
finds the rank for each score and lists them for display
IOException | cannot find and read the highScore.txt |
Variable declaration
Define ranks for each score/user
Display the score list
|
static |
determines the rank of a score
IOException | cannot find and read the highScore.txt |
Variable declaration
For each score/record, if the current score is greater than the previous one, set this score to have a higher rank and return the rank.
|
static |
displays the high score
creates a frame for the display after reading the score file
IOException | cannot find and read the highScore.txt |
Create a JFrame for the display
Read all the score data and put them into an array
Put all the score data into a JTable for display
|
static |
checks whether the score can be in top 20 list
|
static |
reads score data.
reads from file "highScore.txt" and store them into an array.
IOException | cannot find and read the highScore.txt |
Declare a variable to store the file.
|
static |
writes the score onto the file
opens the file "highScore.txt" and updates scores
IOException | cannot find and write the highScore.txt |
Declare a variable to store the file name
Use FileWriter to write scores