I have a JFrame containing some JPanels. Out of all JPanel, one JPanel has a Graphics object (Graphics g) with paintComponent method to paint a Graphics2D image in that JPanel. After complete painting i want don't want to paint the same thing again and again (repaint() does it for me automatically). I want to set this final generated image to the background of the JPanel.
I have an idea, but i want to discuss it. What i can do is, after completing the image, i can use
1) store BufferedImage into Array
2) better would be put image as Icon/Image (http://docs.oracle.com/javase/tutorial/uiswing/components/icon.html) to the JLabel (http://docs.oracle.com/javase/tutorial/uiswing/components/label.html)
Don't create a screen capture. Construct a BufferedImage the same size as the panel and of an appropriate type, obtain its Graphics and call paintComponent(...) of the panel with the Graphics of the BufferedImage. This paints the panel to the BufferedImage.
Moving to Java2D for better topic alignment.