Sunday, November 25, 2012

Java Exercise #64: Display Image

Image icons can be used to display image on labels and buttones. However, ImageIcon displays a fixed size image. We can use the Image class to display images in flexible sizes.

ImageObserver is an asynchronous update interface that receives notifications of image information as the image is constructed. The Component class implements ImageObserver and hence all GUI Components is an instance of ImageObserver. Graphic's drawImage can then be used to draw the image

Exercise: Write a program that draws the following image.

Download Code: Draw Image

No comments:

Post a Comment