Capturing the raster of Swing components without actually displaying them?
My goal is to be able to create an Image/BufferedImage that represents the image of Swing components. Now one solution would be to display the component, take a printscrn of it, and cut the resulting image down so that it only contains the area that the component takes up. However, this requires the component to be displayed to the screen.
Looking for a solution, I found createImage() in java.awt.Component. I tried that, and got a null image. Going back to the javadocs, I found that the component had to be displayable, which was defined as being visible or packed. I tried inserting the component into a JFrame, packed the frame, and then called createImage, only to get a blank Image. I've also tried displaying the JFrame, calling createImage, and displaying the image, but I've had no luck.
To display the Images, I've been encapsulating them in ImageIcons and displaying those.
Any ideas pertaining to a good solution?

