Create an Image in JDialog

Hi,

I am using Eclipse to create a GUI application.

My problem is this... When I run it in Eclipse it finds the images just fine and they show up perfectly... But when I export to a JAR file, the image files either are distorted or don't show up at all... I am not sure if this is my coding or the JAR file...

package iWeatherGrabber;

imports... I got them

public class WindowSplash extends JDialog {

private JLabel useForImage;

ImageIcon logo = new ImageIcon("logo.gif");

Container contentPane;

public WindowSplash () {

contentPane = getContentPane();

setTitle("iWeatherGrabber");

setSize(FRAME_WIDTH, FRAME_HEIGHT);

setLocationRelativeTo(null);

setUndecorated(true);

setForeground(Color.blue);

setLayout(null);

contentPane.setBackground(Color.LIGHT_GRAY);

JPanel Border = new JPanel();

Border.setLayout(null);

Border.setBackground(Color.LIGHT_GRAY);

Border.setBounds(0, 0, FRAME_WIDTH, FRAME_HEIGHT);

contentPane.add(Border);

JPanel main = new JPanel();

main.setLayout(null);

main.setBackground(Color.WHITE);

main.setBounds(5, 5, FRAME_WIDTH-10, FRAME_HEIGHT-10);

Border.add(main);

useForImage = new JLabel(logo);

useForImage.setBounds(5,10,440,51);

main.add(useForImage);

}

}

Message was edited by:

jay2cool

[1423 byte] By [jay2coola] at [2007-11-26 22:20:39]
# 1
URL imageURL = getClass().getClassLoader().getResource("logo.gif");ImageIcon logo = new ImageIcon(imageURL);Try that.
CaptainMorgan08a at 2007-7-10 11:17:52 > top of Java-index,Java Essentials,Java Programming...
# 2
That seems to be working for the moment. Why does that work when ImageIcon logo = new ImageIcon("logo.gif");does not?
jay2coola at 2007-7-10 11:17:52 > top of Java-index,Java Essentials,Java Programming...