I have a question concerning the key bindings. I have the following Java code:
private void registerPressedReleasedKey(String keyChar, boolean key, boolean pressedKey) {
    // 1. decide if the key is pressed or released
    // 2. save key and its action name
    // 3. decide, what to do, when the action name is being mentioned
    // 4. change the boolean value in actionPerformed(ActionEvent ae)
    String keyStatus;
    if(pressedKey == true)
        keyStatus = "pressed ";
    else
        keyStatus = "released ";
            getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(keyStatus + keyChar), keyStatus + keyChar);
    getActionMap().put(keyStatus + keyChar, new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            key = pressedKey;
        }
    });
}
Eclipse says to me that key = keyPressed; is wrong, because I only can use final variables. My question is if there is a possibility to access and change key inside the actionPerformed(ActionEvent ae) method.
 
     
     
    