JavaDeploy
SiteMap
Readers Writers
Java Streams
Java Programming
Java Language
Java Graphics
«Prev
Java Language
Packages Interfaces
Java Classes - Quiz
Java Graphics
Java Graphics - Quiz
Java Graphics Conclusion
MultiThreaded Programming
Multithreaded Programming Basics
Thread Significance Assessment
Create Use Thread Class
Implement Runnable Interface
Sleeping Threads
Thread Synchronization
wait notify Methods
Multithreaded Programming - Conclusion
Set Daemon Threads
Multithreaded Programming - Quiz
Multithreading Fundamentals - Quiz
Handling Exceptions
Understanding Exceptions
Throwing Exception
Catching Exceptions
Catching Exceptions
Custom Exceptions
finally Clause
Handling Exceptions Conclusion
Java Input Output
Create Reader Streams
Loading and drawing Images[AWT - 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 will 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.
Submit