初学者到秋千 [英] Beginner to Swing

查看:115
本文介绍了初学者到秋千的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个简单的Swing应用程序。但是我对Swing有非常非常非常少的经验。我想创建一个单窗口应用程序,刷新每5分钟一个屏幕的内容 - 刮我的。我使用Clojure来编写代码。我假设Swing是与这个一起去的方式,但如果有其他更好的选择,我也想听到更多关于这些的选择。

I'd like to create a simple Swing app. I've got very, very, very little experience with Swing, however. I want to create a one window app that refreshes every 5 minutes with the contents of a screen-scraping that I do. I'm using Clojure to write the code. I assume Swing is the way to go with this, but if there are other, better options I'd love to hear more about those as well.

需要这样做与Swing? (我应该使用什么类别等)

What code would I need to do this with Swing? (what classes should I use, etc)

感谢,
Alex

Thanks, Alex

推荐答案

好了,对于每五分钟, java.util.TimerTask 应该有帮助。对于常规Swing信息,此链接指向Java教程应该有所帮助。

Well, for the every five minutes bit, java.util.TimerTask should be of help. For general Swing information, this link to the Java Tutorials ought to help.

要有一个窗口,具体来说,> JFrame 可能是您最好的选择。

To have a Window, specifically, JFrame is probably your best bet.

要显示单行或多行文本,您应该查看 JLabel JTextArea

To display single or multiline text, you ought to look into JLabel or JTextArea, respectively.

要显示图片,ImageIcon 应该做的。

To display images, ImageIcon ought to do the trick.

对于其他需要,Java教程应该是一个很大的帮助。

For other needs, the Java Tutorial ought to be a big help.

作为 trashgod 建议,javax.swing.Timer有一些优点,当谈到java.util.TimerTask的GUI。有关在Swing应用程序中使用计时器的文章,应该可以帮助您决定使用哪种计时器。

As trashgod suggested, javax.swing.Timer has some advantages when it comes to GUIs over java.util.TimerTask. This article on using timers in Swing applications should help you decide which to use.

这篇关于初学者到秋千的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆