摇摆初学者 [英] Beginner to Swing

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

问题描述

我想创建一个简单的 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)

谢谢,亚历克斯

推荐答案

好吧,每隔五分钟,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.

要显示单行或多行文本,您应该查看 JLabelJTextArea,分别.

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 在 GUI 方面比 java.util.TimerTask 有一些优势.这篇关于在 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天全站免登陆