g trouve ca sur le forum de java.sun.com. Mais je suis un peu debutant en java, et j'y comprend rien a ce code...
Qq1 peut m'aider ?
-------
http://developer.java.sun.com/deve [...] index.html
Question: How do I save a picture drawn on a Canvas object, into a Jpeg file?
Answer:
First you need to use the createImage method with Canvas. (Try createImage(int, int) method of the Component class). This gives you the image. Then you need to paint your canvas onto the new image. Try something like this:
Rectangle rect = can.getBounds();
Image fileImage =
createImage(rect.width,rect.height);
Graphics g = fileImage.getGraphics();
//write to the image
can.paint(g);
// write it out in the format you want
//dispose of the graphics content
g.dispose();