【发布时间】:2013-04-09 16:42:17
【问题描述】:
我正在尝试将银行帐户的值输出到文本框中。该程序是一个银行账户模拟,随着模拟的进行,线程会发生变化。目前这些值正在输出到控制台。
这是当前输出的代码:
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 ;
}
【问题讨论】:
-
您的问题是“如何向我的程序添加 UI?”
-
我在您的问题中没有看到任何与 UI 相关的代码。你打算使用什么样的文本框?摇摆 ? html ?
标签: java multithreading user-interface