views:

80

answers:

3

I am trying to create an image of one of my JPanels at a fixed resolution, or at a resolution that may be bigger than the current screen resolution. Consequently I cannot use a simple screen capture method as it causes my image resolution to be dependent on the resolution of the screen, which the user sets. Is there a way around this?

Alternatively, is there a way to do this in openGL? Create a virtual buffer, render into it, then create an image based on that virtual space?

+4  A: 

Just create the control, you don't need to add it to any JFrame or otherwise cause it to be displayed. You can subsequently use the print method on it to cause it to be rendered to a Graphics object. You can set the size and such as you like without having to take care of the screen boundaries (as the control is never displayed on screen).

Joey
+2  A: 

Look at JxCapture. It's a commersial product but you can get free license if you're developing open-source (or maybe even non-commercial) project.

Roman
+1  A: 

Check out the Screen Image class.

camickr