1 Reply Latest reply on Aug 7, 2012 10:45 AM by Jörg

    Add Image icon to jpanel

      I have to add an image to a jpanel.
      I am using the below code
      I have already defined the jlabel(lblImageIcon) using the netbeans design palette and made the jlabel visibility false.
      lblImageicon=new JLabel


      gridBagConstraints =new java.awt.GridBagConstraints

      gridBagConstraints .gridX=2

      gridBagConstraints .gridY=2

      add(lblImageIcon,gridBagConstraints )

      Then when I have to show the image upon a condition I have the following

      ImageIcon icon = new ImageIcon("http://ipaddress/test/test.png)



      The iamge does not show up.If I do a system.out afetr the line
      ImageIcon icon = new ImageIcon("http://ipaddress/test/test.png)
      It show as http://ipaddress/test/test.png)

      I am not sure whether it is reading the image or not showing the image because of size.Also my application uses applet and I am signing the applet.

      Is there any other way to add the images or what am I doing wrong or missing.