我是scala的新手并且正在练习制作GUI。我使用了以下代码:
import scala.swing._
class UI extends MainFrame {
title = "GUI Program #1"
preferredSize = new Dimension(320, 240)
contents = new Label("Here is the contents!")
}
object GuiProgramOne {
def main(args: Array[String]) {
val ui = new UI
ui.visible = true
println("End of main function")
}
}
并在build sbt中安装了swing库:
libraryDependencies += "org.scala-lang" % "scala-swing" % "2.10.2"
我看到有例外情况:
Exception in thread "main" java.lang.NoClassDefFoundError: scala/Proxy$class
at scala.swing.Window.<init>(Window.scala:25)
at scala.swing.Frame.<init>(RichWindow.scala:75)
at scala.swing.MainFrame.<init>(MainFrame.scala:19)
at UI.<init>(GuiProgramOne.scala:3)
at GuiProgramOne$.main(GuiProgramOne.scala:11)
at GuiProgramOne.main(GuiProgramOne.scala)
Caused by: java.lang.ClassNotFoundException: scala.Proxy$class
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 6 more
我真的很困惑。有人可以指导我吗?感谢
我正在研究这些东西:
http://otfried.org/scala/index_28.html