Meaningless Drivel is fun!*
The moose likes Swing / AWT / SWT and the fly likes images with swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "images with swing" Watch "images with swing" New topic
Author

images with swing

Tim Collins
Greenhorn

Joined: May 31, 2001
Posts: 9
I am trying to insert an image into a very basic swing application. I did some research and attempted to create an ImageIcon object, using the constructor that implements a filename, then tried to add it to a JPanel. The ImageIcon is created without issue, but when I try to add it to the JPanel, I get an "unresolved symbol" error. My theory is that ImageIcon is not the right object to try to insert into the panel. Any ideas?
Thanks
Tim
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

You can put ImageIcons directly onto JLabels and JButtons, but not JPanels... if you wanted to do this you would have to implement this behavior yourself...

-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Tim Collins
Greenhorn

Joined: May 31, 2001
Posts: 9
thanks, that worked. I just initialized a JLabel with an imageicon and it worked like a charm....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: images with swing
 
Similar Threads
Jpcap captured packets not appearing in Swing application's text area
display image in jpanel
Image or ImageIcon?
How to add images
Mouse shift event coding - to trigger a predetermined sequence of images to a GUI