I am using a javax.swing.JPanel to display data in diagrams and graphs.
The routine is this:
EVENT: Size changed -> Children recreate BufferedImages and render their contents. -> Panel calls draw method -> Children draw their images on the Graphics of the BufferedImage used to prebuffer contents in the Panel -> Panel paints the prebuffered Image on the Screen.
On paint(Graphics g) only the prebufferedImage is drawn with g.drawImage(...)
This works fine till 640x480. BUT:
Animation stuff: I start a Thread moving a node from left to right. This causes the Panel to update its contents, what means that the render() method calls the children to draw their Images to the Buffer and then the Buffer is displayed by repaint(). And this takes simply too long and eats CPU like hell.
Can anyone help me to get some Performance tuning. I am using BufferedImages all over. VolatileImage is too slow !