Need Help! Contact me.Email me Thank You.

Display background Image in Applet

Applet Background Image

Displaying backgound Image in an Applet is a two step process.

First - Get the handle to the image using a simplified method getImage() or using the MediaTracker API. This is done in the Applet’s init() method. Using the Media Tracker provides more events/notification that can handled ex.failed to load the media, etc.

Also with Media Tracker a variety of resource types can be retrieved not just image.

Finally - Once the image handle is there, draw the image at a given location in the Applet’s paint(..) method with the drawImage(image,x,y, this) method.

The image can of any format like jpg, gif, png etc.

Subscribe to DeveloperFeedDid you like this article? Did it Help you Solve your Problem? You can get the all the latest articles published at DeveloperFeed in your email inbox by entering your email address below. Your address will only be used for mailing you the articles, and each one will include a link so you can unsubscribe at any time.