jeudi 9 avril 2015

JLabel actionlistener, what to use? Automatic update my labels in Java


Vote count:

0




I'm trying to update my JLabels when my GUI is running. Have create 3 JLabels which contain text and some variables. These variables gets updated automatically when the program is running.


I want to make an actionlistener like the one you can make to a button, but without clicking to update the labels. I want it to update automatically every 1 sec.


Some code of my label:



powermessage = new JLabel("<html> Usage: " + kWh + " kWh <br> <br>" + message + "</html>");


Have before used this method (see under).



button.addActionListener(this);


This worked fine, but i don't want the user to click for the monitor to update.



asked 26 secs ago







JLabel actionlistener, what to use? Automatic update my labels in Java

Aucun commentaire:

Enregistrer un commentaire