java awt bild einfügen code example
Example 1: java awt bild einfügen
BufferedImage image = ImageIO.read(getClass().getResourceAsStream("/bilder/demo.png"));
Example 2: java awt bild einfügen
try {
Image image = ImageIO.read(new FileInputStream("Bilder/demo.png")) ;
JLabel imageLabel= new JLabel(new ImageIcon(image));
imageLabel.setBounds(0, 0, 10, 10);
add(imageLabel);
imageLabel.setVisible(true);
} catch(Exception e) {
JOptionPane.showMessageDialog(this, "Fehler" + "\n" + e);
}