我正在尝试将银行帐户的值输出到文本框。该程序是银行账户模拟,线程随着模拟的进行而变化。目前,这些值将输出到控制台。
以下是目前输出的代码:
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 ;
}