lundi 8 juin 2015

Else statement "syntax error on token else"

I'm writing a class that allows me to set up buttons for incrementing or decrementing numbers. The code for implementing the listener is below, but it's not liking my else statement for some reason:

private class ButtonListener implements ActionListener {
public void actionPerformed(ActionEvent event)
{
    if (event.getSource() == up)
        count++;
        label.setText("Value: " + count);
    else
        count--;
        label.setText("Value: " + count);
}

Aucun commentaire:

Enregistrer un commentaire