public void setNumberTracks(int pattern) throws IllegalArgumentException {
        if (pattern == 1) {
            for (int i = 0; i < songs.size(); i++) {
                //gets the title of the mp3
                String title = songs.get(i).getFileName();
                title = title.substring(title.lastIndexOf(System.getProperty("file.separator")) + 1, title.length() - 4);

                //gets the first two numbers of the file name, they will be the track number
                int num = Integer.parseInt(title.replaceAll("\\D", "").substring(0, 2));

                songs.get(i).setTrack(num + "");

            }
        } else if (pattern == 2) {
            for (int i = 0; i < songs.size(); i++) {
                songs.get(i).setTrack(i + 1 + "");
            }
        } else {
            throw new IllegalArgumentException("The given pattern was neither 1 nor 2");
        }
        fireTableDataChanged();
    }