Scala 小程序 - SimpleApplet 演示
applet 类的 ScalaDoc 非常薄弱有关如何实际覆盖 ui 部分并添加组件的详细信息。它说“客户端应该实现 ui 字段。有关示例,请参阅 SimpleApplet 演示。”
- 这个 SimpleApplet 演示在哪里?
- 除此之外,是否有人有一些使用 Scala Applet 类的简单源代码,而不是直接使用 JApplet 类?
谢谢
The ScalaDoc for the applet class is pretty thin on details on how you actually override the ui piece and add components. It says "Clients should implement the ui field. See the SimpleApplet demo for an example."
- Where is this SimpleApplet demo?
- Barring that, does anyone have some simple source code of using the Scala Applet class, rather than the JApplet class directly?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更新的 ScalaDoc 可能会稍微更有帮助(特别是,新版本的 ScalaDoc 允许您显示/隐藏具体成员,以便您可以专注于您必须实现的内容)。
应该注意的是,您不必定义一个名为 ui 的对象来扩展 UI。 ScalaDoc 所说的更准确、更灵活——“实现 ui 字段”。由于统一访问原则,您可以自由地实现 ui 字段作为
val
或object
(同样,您可以使用val
或var
来实现def
)。唯一的约束(在 ScalaDoc 中反映为val ui : UI
)是例如:
The more recent ScalaDoc may be slightly more helpful (in particular, the new version of ScalaDoc allows you to show/hide concrete members so you can focus on what you must implement).
It should be noted that you don't have to define an object named ui that extends UI. What the ScalaDoc says is both more accurate and more flexible -- "implement the ui field". Because of the Uniform Access Principle, you're free to implement the ui field as a
val
or anobject
(similarly, you can use aval
orvar
to implement adef
). The only constraints (as reflected in the ScalaDoc asval ui : UI
) are thatFor example:
终于找到了一些显示您需要做什么的来源:
http://scala-forum.org/ read.php?4,701,701
换句话说,您定义了一个名为 ui 的对象,该对象扩展了 UI。我从来没有想到过这一点。 ScalaDoc 需要一些认真的工作。
Finally found some source that shows what you need to do:
http://scala-forum.org/read.php?4,701,701
In other words you define an object named ui that extends UI. I never would have thought of that. That ScalaDoc needs some serious work.