Probleme bouton et fonction

Résolu
developvbdebut Messages postés 476 Date d'inscription samedi 14 août 2004 Statut Membre Dernière intervention 2 juin 2012 - 10 avril 2006 à 20:13
developvbdebut Messages postés 476 Date d'inscription samedi 14 août 2004 Statut Membre Dernière intervention 2 juin 2012 - 10 avril 2006 à 20:54
Bonsoir tout le monde

Je souhaiterai initialiser des bouton.

J'ignore comment faire car c'est dans une fonction.

public class Monnayeur


{
public void instruct()

{

String cafe, cafelait, chocolat, the;

if((cafe.equals("café") && sr==0) ||(cafelait.equals("café au lait") && sr==0)||(chocolat.equals("chocolat") && sr==0)||(the.equals("the") && sr==0))

{

animation="Somme insuffisante";


}

else
{
sar = sr-cout;

sar = sar*10;


}

}
}

Voici l'erreur que me sort javac.

Monnayeur.java:83: variable cafe might not have been initialized
if((cafe.equals("cafÚ") && sr==0) ||(cafelait.equals("cafÚ_au_lait") && sr==0)||
(chocolat.equals("chocolat") && sr==0)||(the.equals("the") && sr==0))
^
Monnayeur.java:83: variable cafelait might not have been initialized
if((cafe.equals("cafÚ") && sr==0) ||(cafelait.equals("cafÚ_au_lait") && sr==0)||
(chocolat.equals("chocolat") && sr==0)||(the.equals("the") && sr==0))
^
Monnayeur.java:83: variable chocolat might not have been initialized
if((cafe.equals("cafÚ") && sr==0) ||(cafelait.equals("cafÚ_au_lait") && sr==0)||
(chocolat.equals("chocolat") && sr==0)||(the.equals("the") && sr==0))


^
Monnayeur.java:83: variable the might not have been initialized
if((cafe.equals("cafÚ") && sr==0) ||(cafelait.equals("cafÚ_au_lait") && sr==0)||
(chocolat.equals("chocolat") && sr==0)||(the.equals("the") && sr==0))


^

Comment inititialiser des variable qui sont en faite des bouton.

Merci

Cordialement

A bientôt

2 réponses

bloofi Messages postés 388 Date d'inscription mercredi 1 octobre 2003 Statut Membre Dernière intervention 3 mai 2006 2
10 avril 2006 à 20:32
coucou, essaye comme ca :

String cafe="", cafelait="", chocolat="", the="";
3
developvbdebut Messages postés 476 Date d'inscription samedi 14 août 2004 Statut Membre Dernière intervention 2 juin 2012 1
10 avril 2006 à 20:54
Rebonsoir tout le monde

Ca fonctionne il ne lance pas d'erreur.

J'espere que les boutons vont fonctionner.

Merci

Cordialement

A bientôt
0
Rejoignez-nous