views:

54

answers:

4

I'd like to "capture" a screenshot of what a java applet would currently look like if it were loaded, effectively screenshoting an applet without the use of a vdu.

The purpose of this is to display the image to a user that doesn't have a JVM. Lets assume the applet is a digital clock and has no requirement on user input. So what could be done is set up a pc connected to a vdu, open the applet, schedule a script to take a screenshot and upload the image. Clients could then access what the applet would look like at any given time without the requirement on a jvm.

It'd be such a hassle to have a pc running all the time etc. Surely this could be done somehow without a display.

Would it be possible to create a virtual display in a jvm that can render an applet and then take a screen capture?

If this were possible then perhaps a really high resolution display could be virtualized to create a very high resolution screenshot.

+1  A: 

Look at java.awt.Robot#createScreenCapture(java.awt.Rectangle)

Joel Carranza
+1  A: 

The ScreenImage class should handle this.

camickr
A: 

If this would work, i would wonder, remind the sandbox, and as the above link stated "This will work whether you have an AWT or Swing application."

springfeld
A: 

If you use a "rendering-engine" (composing each pixel to something paintable before repaint()'ing) within you applet, you could use this information and create an image.

springfeld