I have been having the same issue in a previous tutorial I have been working on every time I try to get my program to look for a png file to display radio buttons I get this below:
Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(Unknown Source)
at BT68Gui.<init>(BT68Gui.java:15)
at AT68Gui.main(AT68Gui.java:8)
I am finding it difficult to progress the way Id like too if I keep hitting this brick wall any help will be greatly appreciated I am using Eclipse to write my java programs. Eclipse works through c:\users\owner\workspace ;My png files are in workspace.
  BT68Gui.java program
  / java tutorial 68 JRadioButton
  // Java tutorial 67 final JRadioButton 
  // Java tutorial 69 Drop down list program
  import java.awt.*;
  import java.awt.event.*;
  import javax.swing.*;
  public class BT68Gui extends JFrame{
                  private JComboBox box;
                  private JLabel picture;
                  private static String[] filename = {"b.png, x.png"};// and Array with two elements this Array stores the filename
                  private Icon[] pics = {new ImageIcon(getClass().getResource(filename[0])), new ImageIcon(getClass().getResource(filename[1]))}; // This Array stores the pictures filename 0 is the first element of the Aray
                  public BT68Gui(){
                                  super("The Title");
                                  setLayout(new FlowLayout());
                                  box = new JComboBox(filename);
                                                                  new ItemListener(){ // Anonymous inner class
                                                                                  public void itemStateChanged(ItemEvent event){
                                                                  }// Anonymous inner Class
                                  picture = new JLabel(pics[0]);
  AT68Gui.java program
  //^java tutorial 60 Simple Polymorphic Program
  import javax.swing.JFrame;//*Creates the window
  public class AT68Gui {
                  public static void main(String[] args){
                                  BT68Gui go = new BT68Gui();

Last edited by shabbir; 21Oct2011 at 14:17.. Reason: Code blocks