tags:

views:

3225

answers:

4

From reading parts of the Programming in Scala book, I realize that Scala can work with the Java Swing components to create GUI applications.

My question is if there are any projects or released applications (that are more than just simple examples) that use Scala and Swing?

+3  A: 

There is Scalide at Google code, and then Scala itself has Swing library

DroidIn.net
Thanks for the example.
ZacharyP
You are welcome. Scala is fascinating - isn't it?
DroidIn.net
+7  A: 

Is this because you wish to see some actual Scala Swing code, or are you just interested as to whether Scala Swing is "production-ready"? If it is the latter, Scala Swing is pretty good: I've started using it for all GUI code. Compare:

JButton b = new JButton();
b.setText("OK");
b.setFont(f);
b.setPreferredSize(new Dimension(20, 20));
b.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      //reacction here
    }
});

with:

val b = new Button {
  text = "OK"
  font = f
  preferredSize = (20, 20)
}
listenTo(b)
reactions += {
  case ButtonClicked(`b`) => //reaction here
}

As Scala Swing is really just a lightweight layer on top of Java Swing, you can integrate any Java Swing component easily and be sure that it all works OK.

That said, the documentation as of Scala 2.7 is pretty poor. I understand that Scala Swing is being upgraded in the 2.8 release and that this will include improved documentation.

oxbow_lakes
A bit of both, I suppose. As usual, Scala reads much more easily than its Java equivalent. Thanks.
ZacharyP
+1  A: 

House of Mirrors

I have written this game in Scala. It's open-source and uses Swing via both the Java and Scala library interfaces.

The Scala API is great to work with as oxbox_lakes illustrated. I had to use the Java interface only for specific low level control such as custom alpha composition.

Before the Scala-swing library had become stable, the game was based on Scala-Squib, but that project has paused AFAIK.

HRJ
+2  A: 

I attended a talk recently on Scala and one of the products demo-ed was a Scala-Swing Twitter client. It is open-source and the project is TalkingPuffin. The UI looked pretty slick for a Swing project and I believe the project is looking for contributors.

Thimmayya
That looks like a great example of Scala Swing code. It's a shame the app is now unusable as it hasn't been committed to since some months before the "OAuthocalypse".
Ben James