The code is in this question as the example.
http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21039886.html#11433801import java.io.*;
import javax.swing.*;
public class SaveWorkout {
File file;
public SaveWorkout() {
}
public File load() {
try {
file = new File(System.getProperty("u
ser.dir"))
;
JFileChooser fc = new JFileChooser(file);
AudioAccessory aa = new AudioAccessory();
fc.setAccessory(aa);
fc.setFileFilter(new javax.swing.filechooser.Fi
leFilter () {
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
String name = f.getName();
if (name.endsWith(".au") || name.endsWith(".wav") || name.endsWith(".aiff") || name.endsWith(".aif")) {
return true;
}
return false;
}
public String getDescription() {
return ".wav";
}
});
if (fc.showSaveDialog(null) == JFileChooser.APPROVE_OPTIO
N) {
// createAudioInputStream(fc.
getSelecte
dFile(), true);
file = fc.getSelectedFile();
}
} catch (SecurityException ex) {
//JavaSound.showInfoDialog
();
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
}
System.out.println(file.ge
tName());
return file;
}
}
import java.io.*;
import javax.swing.*;
public class OpenWorkout {
File file;
public OpenWorkout() {
}
public File load() {
try {
file = new File(System.getProperty("u
ser.dir"))
;
JFileChooser fc = new JFileChooser(file);
AudioAccessory aa = new AudioAccessory();
fc.setAccessory(aa);
fc.setFileFilter(new javax.swing.filechooser.Fi
leFilter () {
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
}
String name = f.getName();
if (name.endsWith(".au") || name.endsWith(".wav") || name.endsWith(".aiff") || name.endsWith(".aif")) {
return true;
}
return false;
}
public String getDescription() {
return ".wav";
}
});
if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTIO
N) {
// createAudioInputStream(fc.
getSelecte
dFile(), true);
file = fc.getSelectedFile();
}
} catch (SecurityException ex) {
//JavaSound.showInfoDialog
();
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
}
System.out.println(file.ge
tName());
return file;
}
}