> Estou iniciando no java e estava testando esse applet, s� que deu erro no
> trecho abaixo:  
> 
> **************************************************************************
> **************************************************************************
> *
>                       chooser.setFileFilter(new
> javax.swing.filechooser.FileFilter()
>                               {       public boolean accept(File f)
>                                       {
>                                               return
> f.getName().toLowerCase().endsWith(".gif");
>                                       }
>                               });
> 
> **************************************************************************
> **************************************************************************
> *
> 
> D� esse erro abaixo
> 
> .java:66: <anonymous ImageViewer$1> should be declared abstract; it does
> not define getDescription() in javax.swing.filechooser.FileFilter
>                               {       public boolean accept(File f)
>  
> ^
> 1 error
> 
> 
> O que � ? O que tenho que fazer ?
> 
> 
> Obs  :Se eu tirar esse trecho do programa funciona...
> 
> 
> Valeu...
> 
> Sandro Augusto.
> 
> 
> import javax.swing.*;
> import java.io.*;
> import java.awt.event.*;
> import java.awt.*;
> import java.awt.image.*;
> 
> 
> 
> public class ImageViewer extends JFrame implements ActionListener
> {
> 
> 
>       public ImageViewer()
>       {
> 
>               setTitle("ImageViewer");
>               setSize(300,400);
> 
>               JMenuBar mbar = new JMenuBar();
> 
>               //Menu Arquivo
>               JMenu m = new JMenu("Arquivo");
> 
>               JMenuItem m1 = new JMenuItem("Abrir");
>               m1.addActionListener(this);
>               m.add(m1);
> 
>               JMenuItem m2 = new JMenuItem("Sair");
>               m2.addActionListener(this);
>               m.add(m2);
> 
>               //Menu Sobre
>               JMenu n = new JMenu("Sobre");
> 
>               JMenuItem n1 = new JMenuItem("Ajuda");
>               n1.addActionListener(this);
>               n.add(n1);
> 
>               JMenuItem n2 = new JMenuItem("Sobre o programa...");
>               n2.addActionListener(this);
>               n.add(n2);
> 
>               mbar.add(m);
>               mbar.add(n);
>               setJMenuBar(mbar);
> 
>               label = new JLabel();
>               Container contentPane = getContentPane();
>               contentPane.add(label, "Center");
> 
> 
>       }
> 
> 
> 
>       public void actionPerformed(ActionEvent evt)
>       {
> 
>               String arg = evt.getActionCommand();
>               if (arg.equals("Abrir"))
>               {
>                       JFileChooser chooser = new JFileChooser();
>                       chooser.setCurrentDirectory(new File("."));
> 
> **************************************************************************
> **************************************************************************
> *
>                       chooser.setFileFilter(new
> javax.swing.filechooser.FileFilter()
>                               {       public boolean accept(File f)
>                                       {
>                                               return
> f.getName().toLowerCase().endsWith(".gif");
>                                       }
>                               });
> 
> **************************************************************************
> **************************************************************************
> *
>                       int r = chooser.showOpenDialog(this);
> 
>                       if (r == JFileChooser.APPROVE_OPTION)
>                       {
>                               String name =
> chooser.getSelectedFile().getPath();
>                               label.setIcon(new ImageIcon(name));
>                       }
> 
> 
>               }else if (arg.equals("Sair")) System.exit(0);
> 
>       }
> 
> 
> 
>       public static void main(String[] args)
>       {
>               JFrame frame = new ImageViewer();
>               frame.show();
> 
>       }
> 
> 
>       private JLabel  label;
> 
> 
> }
> 
> 
> 
> 
> 

------------------------------ LISTA SOUJAVA ----------------------------
http://www.soujava.org.br  -  Sociedade de Usu�rios Java da Sucesu-SP
d�vidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
para sair da lista: envie email para [EMAIL PROTECTED]
-------------------------------------------------------------------------

Responder a