我有一个银行账户arraylist
public class JFrameNewAccount extends javax.swing.JFrame {
private List<BankAccount> list = new ArrayList<>();
}
和一个 BankAccount 类
public class BankAccount {
private String accountNo;
private String accountName;
protected double balance;
private String accountType;
public double getBalance() {
return balance;
}
}
另外,我有一个按钮,JFrameNewAccount
可以将数据保存在arraylists
.
private void btnSaveAActionPerformed(java.awt.event.ActionEvent evt) {
BankAccount account = new BankAccount();
account.setAccountName(txt_accountname.getText());
account.setAccountNo(txt_accountnumber.getText());
list.add(account);
}
我有一个 txt_initialbalance 用于余额,我的问题是,如何在我的 arraylists 帐户中添加 txt_initialbalance。