mercredi 22 juillet 2015

Why won't my texts print in my JApplet?

This is the piece of my code that won't work

public void actionPerformed(ActionEvent ev)
 {
  Random rnd= new Random(); 
  for(int n=0;n<2;n++)
  {
     String text= String.valueOf(random[n]);
     output.append(text + " ") ;
  }   
  if (pick[0] == random[0] && pick[1] == random[1]) {
     output.setText ("You have a matching number!"); 
    //this will print
  }
  else if (pick[0] == random[1] && pick[1] == random[0]) {
     output.setText ("You DO NOT have matching numbers!"); 
     //this won't print
  }

  fillArray(random);
}

Aucun commentaire:

Enregistrer un commentaire