java运行出错,找不到符号 符号: 类 FileNameExtensionFilter
下面是部分代码// 打开菜单项的功能实现
openitem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFileChooser jfile = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter("*.txt","txt"); //出错行
jfile.setFileFilter(filter);
jfile.setVisible(true);
int returnval = jfile.showOpenDialog(jfile);
filePath =jfile.getDialogTitle()+jfile.getSelectedFile().getName();
System.out.println(jfile.getSelectedFile());
FileDialog dialog = new FileDialog(new JFrame(), "打开....",FileDialog.LOAD);
dialog.setVisible(true);
filePath = dialog.getDirectory() + dialog.getFile();
System.out.println(filePath);