package br.com.neto.main;
import java.awt.BorderLayout;
import java.awt.Image;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import br.com.neto.util.Constantes;
public class ReadAndShowImage {
@SuppressWarnings("static-access")
public static void main(String[] args) {
Constantes c = Constantes.getInstance();
File imagem = new File(c.FILE_DIRETORIO + c.SLASH + "elfa.png");
Image image = null;
try(InputStream is = new BufferedInputStream(new FileInputStream(imagem))){
image = ImageIO.read(is);
JFrame frame = new JFrame();
JLabel label = new JLabel(new ImageIcon(image));
frame.getContentPane().add(label, BorderLayout.CENTER);
frame.pack();
frame.setVisible(true);
}catch (IOException e) {
System.out.println(e.getMessage());
}
}
}