- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
SimpleGUIApplication
Thu, 2009-02-26, 01:43
I'm following the instructions in Programming in Scala for building a
simple GUI application. I am using NetBeans 6.5 with the Scala plugin. I
have the following code straight from the book:
import scala.swing._
object FirstSwingApp extends SimpleGUIApplication {
def top = new MainFrame {
title = "First Swing App"
contents = new Button {
text = "Click me"
}
}
}
When I try to run this in NetBeans, it tells me there's no main method.
A look at SimpleGUIApplication shows that it does, indeed, include a
main method.
What am I doing wrong here? Is there something about Scala imports that
I don't understand?
Thanks for any help.
Chas. Munat
Seattle
Thu, 2009-02-26, 02:27
#2
Re: SimpleGUIApplication
Are you sure it's saying that it can't find the main method and not the class/object called Main? The plugin generates an object called Main by default, and NetBeans looks for that when you hit "Run." I just copied your code into a new project in NetBeans, and I got that error. After renaming the object to Main, it worked.
Robert
On Wed, Feb 25, 2009 at 7:42 PM, Charles F. Munat <chas@munat.com> wrote:
Robert
On Wed, Feb 25, 2009 at 7:42 PM, Charles F. Munat <chas@munat.com> wrote:
I'm following the instructions in Programming in Scala for building a simple GUI application. I am using NetBeans 6.5 with the Scala plugin. I have the following code straight from the book:
import scala.swing._
object FirstSwingApp extends SimpleGUIApplication {
def top = new MainFrame {
title = "First Swing App"
contents = new Button {
text = "Click me"
}
}
}
When I try to run this in NetBeans, it tells me there's no main method. A look at SimpleGUIApplication shows that it does, indeed, include a main method.
What am I doing wrong here? Is there something about Scala imports that I don't understand?
Thanks for any help.
Chas. Munat
Seattle
2009/2/26 Charles F. Munat <chas@munat.com>