ZordOn2a
Messages postés3Date d'inscriptiondimanche 1 mai 2011StatutMembreDernière intervention 1 mai 2011
-
1 mai 2011 à 20:33
cs_Julien39
Messages postés6414Date d'inscriptionmardi 8 mars 2005StatutModérateurDernière intervention29 juillet 2020
-
2 mai 2011 à 10:01
Bonjour,
Je débute en Java et il y a une erreur que je n'arrive pas à comprendre. C'est Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at Project4.main(Project4.java:35)
Elle apparait à la commande: public static void main (String args[])
class FenCoches ()
{ setTitle ("Exemple de case a cocher");
setSize (400,100);
Container contenu = getContentPane();
contenu.setLayout(newFlowLayout());
coche1 = new JCheckBox ("case 1");
contenu.add(coche1),
coche1.addActionListener (this);
coche2 = new JCheckBox ("case 2");
contenu.add(coche2),
coche2.addActionListener (this);
Etat= new JButton ("Etat");
contenu.add(Etat);
Etat.addActionListener (this);
}
public void actionPerformed (ActionEvent ev)
{ Object source = ev.getSoyurce();
if ( source == coche1) System.out.println ("action case 1");
if ( source == coche2) System.out.println ("action case 2");
if ( source == Etat) System.out.println ("Etat case " + coche.isSelected()+ "" +coche2.isSelected() );
}
private JCheckBox coche1 coche2 ;
private JButton Etat;
}
public class Project4
{
public static void main (String args[])
{ FenCoches fen = new FenCoches ();
fen.setVisible (true);
}
}
}