我正在尝试将银行帐户的值输出到文本框。该程序是一个银行账户模拟,随着模拟的进行,线程会发生变化。目前这些值正在输出到控制台。
这是当前输出的代码:
public BankAccount()
{
accountBalance = 0 ;
}
public synchronized void deposit(int addAmount, String name)
{
// the 'name' argument holds the name of the source of this credit
accountBalance+=addAmount ;
System.out.println(name + " added " + addAmount) ;
System.out.println("Account balance is now standing at " + accountBalance);
}
public synchronized void withdraw(int takeAmount, String name)
{
// the 'name' argument holds the name of the bill being paid
accountBalance-=takeAmount ;
System.out.println(name + " took " + takeAmount) ;
System.out.println("Account balance is now standing at " + accountBalance);
}
public int getBalance()
{
return accountBalance ;
}