开发者

Are there a good examples of using 'scala.swing'? [closed]

开发者 https://www.devze.com 2023-01-31 17:25 出处:网络
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. 开发者_JAVA技巧

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 7 years ago.

Improve this question

I don't know Java or Swing, but I'm quite familiar with Scala, and I have no problems using it for my purposes. But when I try to implement a GUI, I get a lot of problems/bugs that documentation can't easily solve. I guess scala.swing examples could help a lot!

Are there any small but not trivial and well written applications using scala.swing that I could learn from?


There are many good examples in sources. I recommend checking it out.

Also, Ingo posted a nice intro to the scala.swing design.

I found that reading the sources wasn't so hard and helped a lot.


Here's a short presentation by Ken Scambler (slides here) in which he explains the basic idea of scala.swing and does some nice tricks using mixin composition to paint components.


The official scala.swing description has a number of good examples. Also, there are examples in the Programming in Scala book by Martin Odersky and others.


The last chapter (Ch. 33) in Odersky's Programming in Scala goes through the process of making a simple, but certainly non-trivial GUI spreadsheet program using Scala. It's a pretty rich GUI application and the source (as well as explanation) is all there. The chapter before it details GUI programming using scala.swing and is full of examples, but it doesn't have very many complete ones.

Scala isn't used too heavily in creating desktop applications, but it certainly can be done. If you want a GUI with a Scala application, Swing definitely does the trick (it's used in its Java form in a number of popular desktop applications, like Eclipse, and scala.swing is just a wrapper for javax.swing).


scala.swing comes with examples, likely matching "small but not trivial". This is a link to the GitHub home of Scala Swing, /test folder.

It's not enough, but it is the best start.

The Stack Overflow question Tutorial on Swing in Scala? has a reply pointing to a German tutorial, with examples (no need to speak German, keep pushing the buttons).

This tetrix example is not trivial but GUI-simple.

package root is not answering the question directly, but in these circumstances the API is a good start.

0

精彩评论

暂无评论...
验证码 换一张
取 消