Hello,
I have a problem, concerning saving the contents of a JPanel in a JPG. On
the Screen the Graphics of the Jpanel is black on white, but in the JPG its
black on black. The color for the foreground can be changed, so that it is
possible to draw white on black, etc., but it seems not to work to set the
background to white.
I hope someone can help me.
BufferedImage canvImage = new
BufferedImage(wid,hgt,BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = canvImage.createGraphics();
canvas.paintComponent(g2b);
try
{
String filename = "test.jpg";
OutputStream out = new FileOutputStream(filename);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(canvImage);
out.close();
}
catch (Exception e){System.out.println(e);}
System.exit(0);
TIA
Ulrich Knappich