2
Q:

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);
    }
0
BufferedImage image = ImageIO.read(getClass().getResourceAsStream("/bilder/demo.png"));
0

New to Communities?

Join the community