In scala-swing, I can write this simple code:
import scala.swing._
object HelloWorld2 extends SimpleSwingApplication {
val top = new MainFrame()
top.title = "Hello, World!"
top.contents = new Button("a")
}
it works fine but according to doc the type of contents in MainFrame is Seq[Component] whilst the type of Button is Button. So why can I write
top.contents = new Button("a")
without error?
Note the following two method signatures as per API docs
The assignment syntax
actually makes use of mutator
_=methodas explained by Accessors/Mutators