JMenuItem mntmLoad = new JMenuItem("Load");
mntmLoad.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
JFileChooser chooser = new JFileChooser();
chooser.setMultiSelectionEnabled(true);
int option = chooser.showOpenDialog(testgui.this);
if (option == JFileChooser.APPROVE_OPTION) {
File[] sf = chooser.getSelectedFiles();
String filelist = "nothing";
if (sf.length > 0) filelist = sf[0].getName();
for (int i = 1; i < sf.length; i++) {
filelist += ", " + sf[i].getName();
}
statusbar.setText("You chose " + filelist);
}
else {
statusbar.setText("You canceled.");
}
}
});
mnFile.add(mntmLoad);
the compiler show error on this line(The method showOpenDialog(Component) in the type JFileChooser is not applicable for the arguments (testgui))
int option = chooser.showOpenDialog(testgui.this);
any idea?