Convert BufferedImage to ImageIcon
File img = new File("C:\\..\\image.jpg");
BufferedImage bufferedImage = ImageIO.read(img);
ImageIcon imageIcon = new ImageIcon(bufferedImage);
BufferedImage
extends Image
, so it's simply:
new ImageIcon(myBufferedImage);
your bufferimage;
JLabel photo = new JLabel("Photo");
photo.setIcon(new ImageIcon(bufferimage));
Use constructor: ImageIcon(Image image)
, BufferedImage
extends Image
.