Search code examples
javaswingnetbeansimageicon

how to put Image on JPanel using Netbeans


And how do I put Image on a JPanel using Netbeans?


Solution

  • Have a look at this tutorial: Handling Images in a Java GUI Application

    At the same time you could code as well:

    JPanel panel = new JPanel(); 
    ImageIcon icon = new ImageIcon("image.jpg"); 
    JLabel label = new JLabel(); 
    label.setIcon(icon); 
    panel.add(label);