My main goal:
if the user selects a directory it scans the whole folder for mp3 files and returns them. If he selects some mp3 files it returns them.
To return the selected files was an easy one but to scan the directory for mp3’s isn’t as easy as I first thought.
And I think to do that I first new to decide if the user selected a file or directory, but how? Since I can get both with getSelectedFiles().
You can use
File.isDirectory()andFile.isFile()to determine if aFileis a directory or a normal file, respectively.