#### Archived

This topic is now archived and is closed to further replies.

# [java] Images

## Recommended Posts

DefCom    270
I can load images in applets and japplets but can not get them in to applications (JFrame). I have been using Image and ImageIcon and putting them in a label. I get no errors, but it does not display. Any Help would be much appriciated. Thankyou.

##### Share on other sites
pirate_dau    151
Hard to say without you being a bit more specific. Would it be possible for you to post the snippet you''re using to create the ImageIcon and label?

Here''s a quick example of code that I have used in order to display an image:

String fn = "images/picture.jpg";ImageIcon image = new ImageIcon( SplashScreen.class.getResource(fn)); JLabel pic = new JLabel(image); getContentPane().add(pic);

Note that this code is inside a class that extends a JWindow, which is why I am calling getContentPane() like that. But you should get the idea.

-pirate_dau

##### Share on other sites
DefCom    270
Thanks got it now

I had not used the string and has gone straight into

ImageIcon image = new ImageIcon("Image.gif");