例如下面的代码显示了一个简单的表格
import java.awt.Dimension
import swing._
object SunsetTable extends SimpleSwingApplication {
var model = Array(List("BHP", 1).toArray)
lazy val ui = new BoxPanel(Orientation.Vertical) {
val table = new Table(model, Array("Security", "Price")) {
preferredViewportSize = new Dimension(1200, 600)
}
contents += new ScrollPane(table)
}
def top = new MainFrame {
contents = ui
}
}
假设我有一个外部课程
class Counter {
for (i <- 1 to 10) {
// update SunsetTable with i
Thread.sleep(1000)
}
}
我将如何使用计数器 i 更新 SunsetTable“价格”列?