Je suis un peu coincé. Pourquoi ne pas ce travail? Je viens de faire une erreur en disant:Afficher une image .png dans un JFrame?
java.lang.NoSuchMethodError: main
Exception in thread "main"
import java.awt.*;
import javax.swing.*;
@SuppressWarnings("serial")
public class ShowPNG extends JFrame
{
public void main(String arg)
{
if (arg == null) {
arg = "C:/Eclipse/workspace/ShowPNG/bin/a.png";
}
JPanel panel = new JPanel();
panel.setSize(500,640);
panel.setBackground(Color.CYAN);
ImageIcon icon = new ImageIcon(arg);
JLabel label = new JLabel();
label.setIcon(icon);
panel.add(label);
this.getContentPane().add(panel);
this.setVisible(true);
}
}
s/void main publique (String arg)/publique ** statique ** void main (String ** [] ** arg) – OscarRyz