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?

You didn't post the declaration of testgui, but apparently it's not a subclass of Component. The ".this" is even more mysterious.

ok, thx. i found my mistake already

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.