You can use the instance initialization section: new AbstractAction() { { //initialization code goes here } actionPerformed(ActionEvent event) { … } } Show activity on this post. Or you can just access the variables of the outer class from the inner class.