This is what i have so far:
try {
FileOutputStream oFile = new FileOutputStream("photo.jpg");
oFile.write(Picture.getData());
oFile.close();
}catch (Exception e){}
and a bit further on:
ShowImage photo = new ShowImage();
photo.setBounds(280,20,200,350);
this.getContentPane().add(photo);
this.repaint();
where ShowImage extends JPanel:
public class ShowImage extends JPanel {
BufferedImage image;
public ShowImage() {
try {
File input = new File("photo.jpg");
image = ImageIO.read(input);
} catch (Exception ie) {}
}
public void paint(Graphics g) {
g.drawImage(image, 0, 0, null);
}
It will do what I want the second time I run the app: the phot.jpg file is already there from the previous time and the picture will load into the ShowImage, but clearly I don't need the picture of the previous run
