This ensures the reference tf does not change, and so is not accidentally reflected in the inner class.
Something along the lines of:
Code:
JTextField tf = new JTextField();
myPanel.add(tf);
JButton button = new JButton("ok");
button.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent event){
System.out.println(tf.getText());
}
}
);
tf = new JTextField();
myPanel.add(tf);
It's possible that the action listener could be referring to the wrong text field.
So the desgners way back when in the 90s decided to avoid that whole question and simply insist that these references are final.
I wish I had the documentation on it that I read years ago, so I wouldn't have to rely on pure memory here...