Don't repaint a part of a GLJPanel

Hi all ! I’m trying to make a Java2D minimap which would be shown over my GLJPanel.

I subclass a paintComponent method of a JComponent and I draw my minimap into it. This JComponent is added in the renderForeground method of my subclass of GLJPanel. The problem is that this JComponent is repainting at the same framerate as my GLJPanel, this is normal I agree. My minimap needs only few repaint (only when something appears in the world).
How could I avoid repainting my minimap and let it visible at all ?

Thanks !

If I understand your question correctly…

First of all. Due to the painting-system of Swing you’ll have to provide the needed pixel-data everytime the GLJPanel repaints itself. I don’t know how you build up the minimap, but try to cache the appearance within an image. That could improve the speed.

Greets
Klemens