-3
按钮必须添加50到整数,但不是。我不太了解Jframe,所以帮助我们。如何将数字添加到整数?
int money = 0;
...
JButton verlan = new JButton("50 kr\u015F");
verlan.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int moremoney = money + 50;
String x=Integer.toString(moremoney);
textArea.setText(x + " cent");
}
});
@sam那么,他如何从他的'ActionListener'内部访问'money'而不是'final'? –
@TrippKinetics是的。我甚至没有看那部分。所有我看到的是数字:) – sam