Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala and Swing GUI applications

Tags:

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?

like image 417
ZacharyP Avatar asked Oct 15 '09 03:10

ZacharyP


1 Answers

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.

like image 60
oxbow_lakes Avatar answered Sep 18 '22 13:09

oxbow_lakes