ImageIcon : Java Glossary


ImageIcon
A Swing class for encapsulating an Image and provides built-in MediaTracker for it. It is not a JComponent, so it cannot on its own display the Image. There are constructors that will let you fetch the Image from an Image object, or from a file or from an URL (Uniform Resource Locator). There is no constructor to fetch the image directly from a resource. You must use getResource to get you the URL of the resource in the jar given its name, and feed that to the ImageIcon constructor.

You most commonly use an ImageIcon with JLabel. setIcon, JButton.setIcon or JCheckBox.setIcon.

Learning More

Oracle’s Javadoc on ImageIcon class : available:

This page is posted
on the web at:

http://mindprod.com/jgloss/imageicon.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\imageicon.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
Blog
IP:[65.110.21.43]
Your face IP:[54.81.177.140]
You are visitor number