I am not exactly sure what is wrong with my code but, in the process of adding the ActionListeners, I get the error : "local variables referenced from an inner class must be final or effectively final." Appreciate the help :).
for (int i = 0; i < 30; i++) {
button[i].addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == button[i]) {
if (game.panel[i] instanceof Treasure || game.panel[i] instanceof Mine) {
game.incScore(game.referTile(i));
if (game.panel[i] instanceof Treasure) {
treasurelocated++;
//Output onto jta
if (treasurelocated == 4) {
GEnd();
}
} else {
//Output onto jta found mine
}
} else {
//Output onto jta found nothing
game.blank();
}
changeS();
button[i].setEnabled(false);
}
}
});
}