【发布时间】:2020-01-26 06:08:51
【问题描述】:
在 scala-swing 中,我可以编写这个简单的代码:
import scala.swing._
object HelloWorld2 extends SimpleSwingApplication {
val top = new MainFrame()
top.title = "Hello, World!"
top.contents = new Button("a")
}
它工作正常,但根据doc MainFrame 中的contents 类型是Seq[Component] 而按钮类型是Button。那我为什么要写
top.contents = new Button("a")
没有错误?
【问题讨论】:
标签: scala scala-swing