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.

有帮助吗?

解决方案

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()

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top