I have a byte array that comes as a result of doing a get to a method called "getFoto()". Now my question is how to convert this array of bytes into an image, to set this image to a specific JLabel.
InputStream myInputStream = new ByteArrayInputStream(t.getFoto());
BufferedImage someImage;
try {
someImage = ImageIO.read(myInputStream);
Icon icon = new ImageIcon(someImage);
portada.setIcon(icon);
} catch (IOException ex) {
Logger.getLogger(VeryModificarTrailers.class.getName()).log(Level.SEVERE, null, ex);
}
}
portada.setIcon((Icon) Imagen;
is not working