J2EEOnline
GofPatterns OOPortal
prev
  Course navigation
Loading and drawing images - Exercise
   
Objective:Load an image and use the AWT Graphics class to draw it.
Instructions
Create an applet named DrawImage that accepts an image filename as a string parameter and then draws the image to the applet window. The image filename parameter should be named imgName.
If you recall, you use the getParameter() method in the Applet class to obtain parameter values from an HTML file. Following is an example of obtaining the value of a parameter named slogan:
String slogan = getParameter("slogan");
Source files
We have supplied a prepared HTML file in the download file available from the Sitemap page. The specific HTML file for this exercise uses skate.jpg as the imgName. Both the HTML and JPEG files can be found in the 03-07 folder.
Exercise scoring
The full credit for this exercise is 10 points. To receive full credit, you'll need to successfully create the source code for the applet. You will submit your source code .
What to submit
In the text box below, cut and paste the source code for the DrawImage applet. Click, Submit to submit the code .