Friday, May 4, 2012

Dynamically increasing int value on JFrame

I was trying to have a counter in the shape of jLabel on the JFrame that increases its value automatically .

My purpose was to mimic a heart rate of a person so that I would follow further operations based on this value.   I created an arrayList and made it full of integer heart rate values previously recorded in a txt  file. By using SwingWorker class defined in this example,  I was able to get an integer from the list, send it (by publish function) and catch it on the air and write it into label.  By this way I had an application that shows me the hearRate of a person as if it is in real time.






Check this Flipper example. 

Code explanation