Ok so i have been looking this up on the internet but all the stuff i've been finding has been for other stuff or worked in a different way than i wanted it to.
So what i need is a Filetype filter for a FileDialog (not a JFileDialog or anything). The program i have will allow the user to browse for mp3 files, so i need the filter to only show the user those, and it will also allow the user to save mp3 files, so i need it to only allow the user to save the file as a .mp3 extension.
Here's the code which opens the filedialog and pastes the file path into a JTextField 'browsed'.
protected void onBrowse() // opens the browse and sets the browse text field
{
FileDialog fileDialog = new FileDialog(this, "Open/Save");
fileDialog.show();
if (fileDialog.getFile() != null)
{
String directory = fileDialog.getDirectory();
if (!directory.endsWith(File.separator))
{
directory += File.separator;
}
String file = fileDialog.getFile();
browsed.setText(directory + file);
}
}
Please give any suggestions about filters for this sort of code. Thx