熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

將form保存到圖片中

2022-06-13   來源: JSP教程 

   public void OnSaveJPG() {
  Rectangle rect = getBounds();
  BufferedImage image =
  (BufferedImage)createImage(rectwidth rectheight);
  Graphics g = imagegetGraphics();
  paint(g);
  gdispose();
  try {
  FileOutputStream fileStream =
  new FileOutputStream(E:\\Testjpg);
  JPEGImageEncoder encoder =
  JPEGCodeccreateJPEGEncoder(fileStream);
  encoderencode(image);
  fileStreamclose();
  } catch (Exception e) {
  Systemoutprintln(Error saving JPEG file!);
  }
  }
  
  
  

From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19655.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.