How to use Swing with Scala 2.11 in Eclipse?

I just upgraded Scala to 2.11 and now I can not import scala.swing. How can I recover from this? Can I just upload a jar file or something simple? I hope I have nothing to build.

Edit : The solution should be used in Eclipse, if possible, without creating anything from the source.

+4
source share
4 answers

Here is an example of updating your dependencies for this.

In 2.11, many parts of the standard library were divided into their own modules, including Swing material.

+4
source

, Scala.swing.

, , , .

1) jar javaBuildPath ( Project → Proprties- > javaBuildPath- > Jars- > add Scala.swing.x)

2) Over come typeNotFound errors

3) ,

4) , main()

5) SimpleSwingApplication, call startup().

6) ,

, , ,

 class FirstUI  extends SimpleSwingApplication
{

       def top= new MainFrame {
       title = "GUI Program #1"
       preferredSize = new Dimension(320, 240)
       contents = new Label("Here is the contents!")

  }

}

    object First
    {
      def main(str: Array[String])
      {
            val f =new FirstUI
            f.startup(str)
      }
    }

First.scala . , .

+1

scala-swing.jar .

- . README , . Scala v2.11. jar.

jarfile, eclipse ( / ). " Java" , .

, scala-library.jar ( zip , Scala). "" Eclipse .

0

. , scala-swing.jar scala-library.jar /usr/share/java/scala/ JAR . ( > Java> )

JRE System Library . , " : JRE (java-1.8.0-openjdk-1.8.0.212.b04-0.fc29.x86)" , " : JavaSE-1.8 (java-1.8.0-openjdk-"). 1.8.0.212.b04-0.fc29.x86_64) ". , , " " " "

Fedora 29 Eclipse , " Scala", scala-library.jar JAR .

scala: " scala, plotchartlib (2.10.6), , IDE scala (2.12.3). Scala ".

, > Java> , " Scala [2.12.3]" scala-library.jar.

, , Eclipse Fedora 29, 2 , .

0

All Articles