I just started learning Scala, and as part of the process, I've been trying to write some simple scripts that use Swing.
Here is an extremely stripped down example which exhibits the problem that I am seeing.
SimpleSwingApp:
import scala.swing._
object SimpleSwingApp extends SimpleSwingApplication {
def top = new MainFrame {
println ("Starting")
title = "First Swing App"
contents = new Button { text = "Click me" }
}
}
When I run the script through the Eclipse Scala IDE as a Scala Application, everything works as expected. I get the expected "Starting" text printed to the Eclipse console and the little GUI pops up and waits for a click.
When I try to run it as a script from the command line, I get nothing.
> scala SimpleSwingApp.scala
No error message, no "Starting", no GUI.
So what is going on, and how can I achieve the result that I want (ie, starting a Scala GUI script from the command line)?