我是新来的java。我创建项目,我有一个textField和一个按钮。我做按钮的功能,在那里我开始我的其他功能,没关系。但是,我需要从文本框取数的值作为参数为我的功能...如何从其他文本字段的文本字段中获取int值
b1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
int price;
int quantity = Integer.parseInt(tf2.getText());
int totalamount = price*quantity;
//need to insert this total amout into textfield tf4 //
tf4.getText(totalamount); //showing error ;
}
});
帮我请,谢谢你提前
您是否想要设置总金额为tf4?只是做tf4.setText(Integer.toString(totalamount)); – Freak
tf4.getText(Integer.toString(totalamount)); – StanislavL
你想做什么... – Parth