public void loadPreferences() {
        if (!lastUserFile.exists()) {
            // Prompt for a username
            String message = "It looks like it's the first time this program has been used.\nEnter your user name:";
            String username = JOptionPane.showInputDialog(message);
            try {
                pref = new Preferences(username);
            }
            catch (SQLException e) {
                e.printStackTrace();
            }
        }
        else {
            try {
                Scanner scanner = new Scanner(lastUserFile);

                if (scanner.hasNext()) {
                    String username = scanner.nextLine();
                    if (scanner.hasNext()) {
                        int user_id = Integer.parseInt(scanner.nextLine());
                        pref = new Preferences(user_id, username);
                    }
                    // When there's only 1 line
                    else
                        pref = new Preferences(username);
                }
                // When the lastUserFile is an invalid empty file
                else
                    pref = new Preferences();

                scanner.close();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            catch (SQLException e) {
                e.printStackTrace();
            }
        }

        // Update last user file
        ChangePreferences.writeLastUserToFile(pref.getUsername(), pref.getID());
    }