aspose file tools*
The moose likes Java in General and the fly likes imageicon Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "imageicon" Watch "imageicon" New topic
Author

imageicon

matt prowell
Greenhorn

Joined: Jul 12, 2004
Posts: 18
I tried using an ImageIcon to display a graphic in a Jframe like suggested. I am still having some problems with it. This is what I ahve

ImageIcon icon = new ImageIcon("smile.jpg");
JLabel label = new JLabel(icon);
mainPanel.add(label);


It loads but does not display anything. Thanks!
Dave Wingate
Ranch Hand

Joined: Mar 26, 2002
Posts: 262
Do you mean that the frame does not appear at all? Or that the frame appears but does not contain the image as you expected?

If the former, the problem may well be that you forgot to call mainFrame.pack();
mainFrame.show();


Fun programming etcetera!
matt prowell
Greenhorn

Joined: Jul 12, 2004
Posts: 18
It opens but it does not display the image.
matt prowell
Greenhorn

Joined: Jul 12, 2004
Posts: 18
I am trying to get an Image to display inside a jframe Panel. I tried the imageicon and nothing displays.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: imageicon