forum.misfu.com : Forum Informatique et logiciels, discuter sur le forum de discussion
 


 Mot :   Pseudo :  
 
Bas de page
Auteur
 Sujet :

Besoind' aide en java

 
n°35
pyfeu
Invité
Posté le 05-05-2008 à 18:32:43  answer
 

bonjour à tous!
voila je dois rendre pour demain un programme de pendu avec interface graphique et il s'avère que j'ai un problème que je n'arrive pas à résoudre:
public String getMotCourant()
  {
     
    return motCourant.toString();
  }
 qui apartient à la class public PenduModel  
  et ceci est appelé à partir de class public PenduPanel :
  public void taperLettre(){
   
  if(!terminer){ //tant que le partie de pendu n'est pas finie
   
   try{
     
     
    terminer = pendu.jouer(champ.getText().toUpperCase().charAt(0)); // On joue la premiere lettre du JTextField et on stocke le booleen retourne pour verifier si la partie est terminee ou non
    potence.n = pendu.getNbCoups();
    potence.repaint();
    motCourant.setText(pendu.getMotCourant()); // On met a jour le mot courant
    motCourant.getMotCourant();
    champ.setText("" );
     
    if(terminer){ // Si la partie est finie
     
      if(pendu.getNbCoups()==0)
     {
      motCourant.setText("Vous avez perdu! Le mot était "+ pendu.getMot());
      champ.setEditable(false); // On ne peut plus écrire dans le champ
     }
     
     else  
     {
      motCourant.setText("Vous avez gagné! Felicitation! Le mot recherche etait bien "+ pendu.getMot());
      champ.setEditable(false); // On ne peut plus ecrire dans le champ
     }
     
     
    }
     
   }
   catch(StringIndexOutOfBoundsException e){  
   
    System.out.println("Veuillez saisir une lettre!" );  
     
   }
   
  }
 }  
 voici l'erreur lors de la compilation :
 PenduPanel.java:88: cannot find symbol
 symbol : method getMotCourant()
 location: class javax.swing.JLabel
    motCourant.getMotCourant();
Merci de m'aider :)  

mood
Posté le 05-05-2008 à 18:32:43  profilanswer
 


Aller à :
Ajouter une réponse
 


Contact |  Annuaire gratuit |  Cours informatique | Forum de discussion |  Logithèque
Copyright Misfu.com ® 2005 - 2007 Tous droits réservés