WEB开发网
开发学院WEB开发Jsp 将form保存到图片中 阅读

将form保存到图片中

 2008-01-05 09:49:59 来源:WEB开发网   
核心提示: public void OnSaveJPG() {Rectangle rect = getBounds();BufferedImage image = (BufferedImage)createImage(rect.width, rect.height);Graphics g = image.getGraphics(

   public void OnSaveJPG() {
  Rectangle rect = getBounds();
  BufferedImage image =
  (BufferedImage)createImage(rect.width, rect.height);
  Graphics g = image.getGraphics();
  paint(g);
  g.dispose();
  try {
  FileOutputStream fileStream =
  new FileOutputStream("E:\\Test.jpg");
  JPEGImageEncoder encoder =
  JPEGCodec.createJPEGEncoder(fileStream);
  encoder.encode(image);
  fileStream.close();
  } catch (Exception e) {
  System.out.PRintln("Error saving JPEG file!");
  }
  }

Tags:form 保存 图片

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接