Inner Classes in Java
<p>I am making a keyboard-like buttons for my Hangman game (<a href="http://stackoverflow.com/questions/4836975/java-hangman-project-action-listener">SEE PICTURE HERE</a>), my problem is about the inner classes. I've read this <a href="http://stackoverflow.com/questions/4732544/why-are-only-final-variables-accessible-in-anonymous-class">LINK</a> about inner classes and it says that you can only access the outside variables with <code>FINAL</code> type. But if I declared the variable as such, I cannot change the value of it anymore... So my problem is that I need to change the value inside the inner class. My code is as follows:</p>

<pre><code>public class MainGame extends JDialog {

    private String player;
    private char [] wordChar;
    private JButton[] buttons;
    private int level;
    private int score;
    private int livesLeft;
    private int missedGuess;

 void newGame() {

        level = 0;
        score = 0;
        livesLeft = 10;
        missedGuess = 0;

       //label1:
       // while (livesLeft!= 0) {

            //get random WORD from LIST
            Word hiddenWord = new Word();

            //put random word in Array
            wordChar = new char[hiddenWord.getHiddenWord().length()];
            wordChar = hiddenWord.getHiddenWord().toCharArray();

            buttons = new JButton[wordChar.length];
            for (int i = 0; i &lt; wordChar.length; i++){
                JButton guessWord = new JButton(" ");
                guessWord.setFont(new Font("Microsoft Sans Serif", 1, 18));
                guessWord.setEnabled(false);

                jPanel3.setLayout(new GridLayout(1, wordChar.length));
                jPanel3.add(guessWord);

                buttons[i] = guessWord;
            }
      checkLetter();
      }

    void checkLetter() {
         int checker = 0;
         while(checker != wordChar.length){
            jPanel1.setLayout(new GridLayout(3, 9, 3, 5));
            for (char buttonChar = 'a'; buttonChar &lt;= 'z'; buttonChar++) {
                String buttonText = String.valueOf(buttonChar);
                final JButton letterButton = new JButton(buttonText);
                letterButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        String actionCommand = e.getActionCommand();
                        for (int j = 0; j &lt; wordChar.length; j++){
                            String text =  String.valueOf(wordChar[j]);
                            if(actionCommand.equals(text)){
                                buttons[j].setText(text);
                                checker++; //THIS CODE IS NOT POSSIBLE!!!!
                            }
                        }
                    }
                });
                jPanel1.add(letterButton);
             }
               checker++;
          }
        }
</code></pre>

<p>NOTE: The code above is not complete.
The int checker is used to count how many correct letters are already guessed so that if it is equal to the length of the word, I can now proceed to the next level<img src="http://i.stack.imgur.com/Mnr1S.png" alt="enter image description here"></p>

<p>How can I re-do my code?</p>
