BufferedImage has a getSubimage(x, y, width, height) method that returns an Image. I am drawing graphics on a JPanel, how would I do something similar to the BufferedImage method with a JPanel?
For example (if only it was correct):
BufferedImage bi = jPanel.getSubimage(x, y, width, height);
Thank you
You can render probably any swing component to a buffered image.
Since you just need a sub-image I guess that would make a 2 step process, 1) render your JPanel to a BufferedImage, 2) Get subimage of that.
Note: this will only work after all components are initialized, positioned, etc. and displayed.