08/02/25 09:49:44
ド素人質問ですみません;;
テキストフィールドに入力された文字列を
ボタンが押されたときに変数com_defに入力する
プログラムを作りたいのですが、
下のようにやるとローカル変数 i は内部クラスからアクセスされます。final で宣言される必要があります。
とエラーが出ます。
対処法を教えてください。よろしくお願いします。
text[i] = new JTextField("",2);
button1[i] = new JButton("変更");
button1[i].addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
int com_def = Integer.parseInt(text[i].getText());
System.out.println(""+com_def);
}
});