public static void addRecord(String name, Integer score) {
//        try {
//            System.out.println(name + score.toString());
//            //PrintWriter writer = new PrintWriter(HighScores.class.getResource("HighScores/HighScores.txt").getPath());
//            //PrintWriter writer = new PrintWriter("HighScores.txt");
//            File file = new File(resourceUrl.toURI());
//            OutputStream output = new FileOutputStream(file);
//            PrintWriter writer = new PrintWriter(output); //use outputstream one
//            System.out.println("Writer successfully initialized");
//            String fullString = name + "                                ".substring(name.length()) + score.toString();
//            writer.append(fullString);
//            //writer.println(fullString);
//            writer.close();
//            System.out.println("Append and close done.");
//        } catch (Exception e) {
//            System.out.println(e);
//        }
        Properties highScores = new Properties();
        //InputStream input = HighScores.class.getResourceAsStream("HighScores.properties");
        FileInputStream input = null;
        try {
            input = new FileInputStream("HighScores.properties");
        } catch (FileNotFoundException ex) {
            Logger.getLogger(HighScores.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            highScores.load(input);
            input.close();
            boolean gettingPossibleName = true;
            while (gettingPossibleName == true) {
                if (highScores.containsKey(name)) {
                    String newName = JOptionPane.showInputDialog(null,"Name taken. Enter new name:");
                    if (newName != null) {
                        name = newName;
                    }
                } else {
                    gettingPossibleName = false;
                }
            }
        } catch (IOException ex) {
        } catch (NullPointerException ee) {
        }
        
        highScores.setProperty(name, score.toString());
        sortProperties(highScores);
        FileOutputStream output;
        try {
            //output = new FileOutputStream(new File("HighScores.properties"));
            //highScores.store(output,"");
            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
            //URL url = classLoader.getResource("HighScores/HighScores.properties");
            //URL url = HighScores.class.getResource("HighScores.properties");
            //System.out.println(url.toString());
            File saveFile = new File("HighScores.properties");
            if (! saveFile.exists()) {
                saveFile.createNewFile();
            }
            highScores.store(new FileOutputStream(saveFile), "");
            //highScores.store(new FileOutputStream(new File(url.toURI())), "");
            //highScores.store(new FileOutputStream(new File("HighScores.properties")),""); //works out of jar...
        } catch (FileNotFoundException ex) {
            System.out.println(ex);
        } catch (IOException ex) {
            System.out.println(ex);
        }
        
    }