Beginner to Swing

后端 未结 6 1691
难免孤独
难免孤独 2021-01-12 08:33

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

6条回答
  •  时光说笑
    2021-01-12 08:50

    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.

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

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

    To display images, ImageIcon ought to do the trick.

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

    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.

提交回复
热议问题