プログラムに を入れていJFileChooser
ますが、それは画像しか取りません。そこで、フィルターを追加することにしました。
コード
import javax.swing.*;
public class fileChooser {
public static void main(String[] args) {
JPanel panel = new JPanel();
final JFileChooser fc = new JFileChooser();
int file = fc.showOpenDialog(panel);
fc.addChoosableFileFilter(new ImageFilter());
fc.setAcceptAllFileFilterUsed(false);
}
}
Javaチュートリアルから直接得ました。しかし、Eclipse は以下をエラーとして下線で示します。
fc.addChoosableFileFilter(new ImageFilter());
fc.setAcceptAllFileFilterUsed(false);
助言がありますか?