vendredi 23 septembre 2016

How to use values from if else statements

I have a little Issue... I created two integer variables that are used in my if else statements (depending on the outcome of the action done in the if else statement).... I want to add these values and display them as a score....thanks for the help this is what my code luks like;

int scor = 3;
String scors = Integer.toString(scor);
int fail = 0;
String fails = Integer.toString(fail);

quest.addActionListener(new ActionListener) {
public void actionPerformed (ActionEvent p) {

if (point.equals(points.get(0) {
 //some action....
    if (//some action).equals (//some variable) {
    points.get(0).setText(scors) }
     else if (//some action).equals(//some variable) {
    points.get(0).setText(fails) }
}
else if (point.equals(points.get(1) {
 //some action......
     if (//some action).equals(//some variable) {
    points.get(1).setText(scors) }
      else if (//some action).equals(//some variable){
    points.get(1).setText(fails) }
     }
//I want to get these values from setText in the if statements and add them up  then display them as the scores!
}
});

Aucun commentaire:

Enregistrer un commentaire