How to make a Scala Applet whose Applet class is a singleton?
- by Jamie
Hi, I don't know if a solution exists but it would be highly desirable.
I'm making a Scala Applet, and I want the main Applet class to be a singleton so it can be accessed elsewhere in the applet, sort of like:
object App extends Applet {
def init {
// do init here
}
}
Instead I have to make the App class a normal instantiatable class otherwise it complains because the contructor is private. So the ugly hack I have is to go:
object A {
var pp: App = null
}
class App extends Applet {
A.pp = this
def init {
// do init here
}
}
I really hate this, and is one of the reasons I don't like making applets in Scala right now.
Any better solution? It would be nice...