The ImageIcon component will show an image via its associated ImageReference.
It can be clicked on and it will inform its ActionListener of this event. In this respect it is much like a Button with only an image attached.
However unlike a Button, the ImageIcon component can be used to scale the image to a different size to which it is defined in its associated ImageReference
|
|
ImageIcon icon;
ImageReference imgRef = getImage("SunFlowers.jpg", 187, 238);
icon = new ImageIcon(imgRef);
icon = new ImageIcon(imgRef, 100, 50);
icon = new ImageIcon(imgRef, 70, 140);
|