public void writeJPEGImage(File file){
  int width=vv.getWidth();
  int height=vv.getHeight();
  BufferedImage bi=new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);
  Graphics2D graphics=bi.createGraphics();
  vv.paint(graphics);
  graphics.dispose();
  try {
    ImageIO.write(bi,"jpeg",file);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

public void writeJPEGImage ( File file ) { int width = vv . getWidth ( ) ; int height = vv . getHeight ( ) ; BufferedImage bi = new BufferedImage ( width , height , BufferedImage . TYPE_INT_RGB ) ; Graphics2D graphics = bi . createGraphics ( ) ; vv . paint ( graphics ) ; graphics . dispose ( ) ; try { ImageIO . write ( bi , "jpeg" , file ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } }
copy the visible part of the graph to a file as a jpeg image
