以下、私はString tempの値をStringListに代入して、actionlistenerクラスの外部で作業できるようにしようとしています。私は、変数が最終的に、または効果的に最終的でなければならないというエラーを得る。それは上で働くことができるようにクラスの外にtempの値を取得する方法はありますか?Javaテキストフィールド、リスナークラスの内部からの文字列を転送
String test;
textField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
temp = UserScreen.textField.getText();
UserScreen.messageAppend(temp);
test = temp;
}
});
http://stackoverflow.com/questions/4732544/why-are-only-final-variables-accessible-in-anonymous-class –