Question

I am reading data continuously from a sensor and want to plot chart using that data. I already create that chart, however, system draws that chart for only the first reading, doesn't change the plot dynamically.

I used paintComponent() and I try to update that by using repaint. I have found that though data updates continuously, but the program doesn't execute paintComponent() for more than one time.

any suggestion to solve that problem would be highly appreciated.

Was it helpful?

Solution

Try

validate() or revalidate()

and then,

call repaint()

Hope this will help.

Helpful Link : http://docs.oracle.com/javase/6/docs/api/javax/swing/JComponent.html#revalidate()

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top