rendered paste bodypublic void savePicture(int id) { if ( picture == null) return; String picName = getPicName(id); File im = new File(picName); BufferedImage bm = new BufferedImage(picture.getIconWidth(), picture.getIconHeight(), BufferedImage.TYPE_INT_RGB); Graphics2D g =(Graphics2D) bm.createGraphics(); g.drawImage(picture.getImage(), 0,0,null); try{ if ( ! im.canWrite() && im.exists()) throw new IOException("image file is not writable!"); else ImageIO.write(bm, "JPG_IMG", im); }catch( IOException e){ JOptionPane.showConfirmDialog(pP,"could not save picture", "error", JOptionPane.CANCEL_OPTION, JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } }