How an image can be loaded onto the Canvas.

I do not know how should i proceed to load an image onto the canvas at runtime?If possible give me the source code along with the instructions to be followed for applying that source code.
[209 byte] By [savan_anjariaa] at [2007-11-26 21:12:11]
# 1

You can use java.awt.Toolkit.getImage, or better yet javax.imageio.ImageIO.read if you're using a modern JDK (1.4 and above).

Then when you have the Image object, use java.awt.Graphics.drawImage to display it. You'd do that in the Canvas's paint method.

Read the docs for more info.

paulcwa at 2007-7-10 2:49:52 > top of Java-index,Java Essentials,New To Java...