我无法在我的 scala-sdk-2.12.4 中使用 swing 库。我正在使用 Java 9 版本。当我尝试运行程序时:
package rs.ac.bg.etf.zd173013m.gui
import swing._
object HelloWorld extends SimpleSwingApplication {
def top = new MainFrame {
title = "First Swing App"
contents = new Button {
text = "Click me"
}
}
}
我收到以下错误:
Exception in thread "main" java.lang.IncompatibleClassChangeError: Method scala.swing.Reactor.$init$()V must be InterfaceMethodref constant
at scala.swing.SwingApplication.<init>(SwingApplication.scala:4)
at scala.swing.SimpleSwingApplication.<init>(SimpleSwingApplication.scala:13)
at rs.ac.bg.etf.zd173013m.gui.HelloWorld$.<init>(Application.scala:5)
at rs.ac.bg.etf.zd173013m.gui.HelloWorld$.<clinit>(Application.scala)
at rs.ac.bg.etf.zd173013m.gui.HelloWorld.main(Application.scala)