Hi,
I have a java3d app wich run in a jFrame.
I wrote a method wich allow the user
to capture this frame and write it in a jpeg file.
The problem is it captures the frame borders
but not the canvas wich is inside.
Here is the code:
private void
snapshotbuttonActionPerformed(java.awt.event.ActionEvent evt)
{
File
homedir=new
File(System.getProperty("user.home"));
Dimension size = CanvasFrame.getSize(); BufferedImage myImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = myImage.createGraphics(); CanvasFrame.paintAll(g2); //same problem with paint(), print() or printall() classes try { OutputStream fileout = new FileOutputStream(homedir+"\\Capture.jpg"); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(fileout); encoder.encode(myImage); out.close(); } catch (Exception e) {System.out.println(e);} }
Whats going wrong?
Thanks in advance,
Olivier.
|