This page is no longer maintained — Please continue to the home page at www.scala-lang.org

SimpleGUIApplication

2 replies
Charles F. Munat
Joined: 2008-12-29,
User offline. Last seen 42 years 45 weeks ago.

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

Ishaaq Chandy
Joined: 2009-02-16,
User offline. Last seen 42 years 45 weeks ago.
Re: SimpleGUIApplication
Works for me on my eclipse plugin. You sure you setup your project correctly? If you are sure, then it could also be a bug in the netbeans plugin.

2009/2/26 Charles F. Munat <chas@munat.com>
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

Robert Kosara
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
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:
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

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland