是否有使用“scala.swing”的好例子?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4515008/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 02:40:45  来源:igfitidea点击:

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

swingscalascala-2.8scala-swing

提问by ?ukasz Lew

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.swingexamples could help a lot!

我不知道 Java 或Swing,但我对 Scala 非常熟悉,并且将它用于我的目的没有问题。但是当我尝试实现 GUI 时,我遇到了很多文档无法轻松解决的问题/错误。我想scala.swing 的例子会很有帮助

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

是否有任何我可以学习的使用 scala.swing 的小型但不平凡且编写良好的应用程序?

采纳答案by pedrofurla

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

来源中有很多很好的例子。我建议检查一下。

Also, Ingo posted a nice introto the scala.swing design.

此外,Ingo 发布了一个很好的 scala.swing 设计介绍

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

我发现阅读资料并不难,而且很有帮助。

回答by Carlos López-Camey

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.

这是Ken Scambler的简短演示此处为幻灯片),他在其中解释了 scala.swing 的基本思想,并使用混合组合绘制组件做了一些不错的技巧。

回答by fehu

The official scala.swing descriptionhas a number of good examples. Also, there are examples in the Programming in Scalabook by Martin Odersky and others.

官方scala.swing 描述中有许多很好的例子。此外,Martin Odersky 和其他人在Programming in Scala一书中也有一些例子。

回答by Rafe Kettler

The last chapter (Ch. 33) in Odersky's Programming in Scalagoes 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.

Odersky 的《Scala 编程》的最后一章(第 33 章)介绍了使用 Scala制作一个简单但肯定不平凡的 GUI 电子表格程序的过程。这是一个非常丰富的 GUI 应用程序,源代码(以及解释)都在那里。它之前的章节详细介绍了使用 scala.swing 进行 GUI 编程,并且有很多示例,但没有太多完整的示例。

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, Swingdefinitely 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 在创建桌面应用程序时并没有被过多使用,但它当然可以做到。如果您想要带有 Scala 应用程序的 GUI,Swing绝对可以解决问题(它在许多流行的桌面应用程序中以 Java 形式使用,例如Eclipse,而 scala.swing 只是 javax.swing 的包装器)。

回答by Rob Crowther

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

scala.swing 带有示例,可能匹配“小但不平凡”。这是Scala SwingGitHub 主页 /test 文件夹的链接

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).

Stack Overflow 问题Scala Swing 教程?有一个指向德语教程的回复,带有示例(无需说德语,继续按按钮)。

This tetrix exampleis not trivial but GUI-simple.

这个 tetrix 示例不是微不足道的,而是简单的 GUI。

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

package root没有直接回答问题,但在这些情况下,API 是一个好的开始。