[nbusers] Adding a .JPG image onto a label... does not display image...attached is my code

  • From: "jarmenda" < >
  • To:
  • Subject: [nbusers] Adding a .JPG image onto a label... does not display image...attached is my code
  • Date: Sat, 24 Nov 2012 15:39:18 -0500

import java.awt.BorderLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

 @SuppressWarnings("serial")
public class Exercise16_13 extends JFrame
 {
         private static JLabel label = new JLabel();
         private static ImageIcon image = new ImageIcon();
         private static JPanel panel = new JPanel();
         
         public Exercise16_13 (String title) {
                 super(title);
                                 
                 String pic1 = "Flash Mob.jpg";
                 
                 image = new ImageIcon(pic1);
                 label.setIcon(image);
                 label.setOpaque(true);
                 panel.add(label, BorderLayout.CENTER);
                 add(label);
         }
         
         public static void main(String[] args)
         {
                 JFrame frame = new JFrame();
     
                 frame.setSize(800, 600);
                 frame.setLocation(350, 50);
                 frame.setTitle("Slide Show");
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                 frame.setVisible( true );                   
         }
 }






[nbusers] Adding a .JPG image onto a label... does not display image...attached is my code

jarmenda 11/24/2012

[nbusers] Re: Adding a .JPG image onto a label... does not display image...attached is my code

Edson Richter 11/26/2012

[nbusers] Thanks...Got it to work moved images below the jdk library in project

jarmenda 11/26/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close