-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWavFilter.java
More file actions
39 lines (33 loc) · 803 Bytes
/
WavFilter.java
File metadata and controls
39 lines (33 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package aoop;
import java.io.File;
import javax.swing.filechooser.*;
/**
* Filters out all files but .wav
* @author Daniel and Erik
*/
public class WavFilter extends FileFilter{
/**
* Sets which files to be accepted
* @param f file to be checked
* @return if file is .wav or not
*/
@Override
public boolean accept(File f) {
if(f.isDirectory())
{ return true;}
String extension = f.getName();
int i = extension.lastIndexOf('.');
if (i > 0) {
extension = extension.substring(i+1);
}
return extension.equalsIgnoreCase("wav");
}
/**
* Description
* @return description of file
*/
@Override
public String getDescription() {
return "*.wav";
}
}