I have question how to create a performant swing component.
The component should draw some kind of bar chart. The data for the component are stored in a separte FIFO buffer class. Everytime the buffer is updated the component is informed.
At the moment the component draws a BufferedImage everytime the data changes. The paintComponent method of the bar chart component then draws the created BufferedImage.
Due to the fact that there are a lot of data changes in my application, I am thinking to improve the painting of the BufferedImage. Most of the bar chart remains the same. It is just shifted to the right and the latest data changes are added to the left of the bar chart.
At the moment the whole BufferedImage is recreated out of the data stored in the buffer. What I could think of is to shift the old BufferedImage using AffineTransformation and only add the recently added data. This would enormously decrease the amount of drawing operations on the BufferedImage.
But I do not know if this will speed up the application. How expensive is the AffineTransformation on a BufferedImage?
Any remarks are welcome. Also some other hint how to create a performant swing application.
Thanks in advance