What you've just described is the appropriate behavior. If you create a variable inside a block, like an if statement or an actionPerformed() method, that variable won't be visible outside of that...