This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Picture Woes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Picture Woes" Watch "Picture Woes" New topic
Author

Picture Woes

Atrus Greyor
Ranch Hand

Joined: Mar 07, 2004
Posts: 110
How can you put a picture into a frame? I have tried the ImageIcon but it doesn't want to work for me?

Here is my code that SHOULD display a picture but it does not?



If anyone is able to help me it would be greatly apprecited!
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
You have to choose between AWT and Swing. It is generally recommended to not mix them. The ImageIcon and JLabel classes are both in the javax.swing package (see api).

If you choose AWT then this is one way to show an image.
 
 
subject: Picture Woes
 
Similar Threads
jpeg in a Jpanel
Image is not been added to a label
Picture not appearing
trouble displaying ImageIcon
How to make an image a component for JScrollPane ?