Write a Java program that can be run both as an applet and as an application. The program should download and display an image in the center of the window. In case of resizing the window, the image should be recentered. The image location should be read from a command line paramenter in case of an application, and from a parameter called "img-location" in case of an applet. Some default value should be assumed if no parameter is found. (Point it to an image that is posted on your Web site.) In addition to drawing an image your program should draw a three pixel border around the image.
Make sure that your program will work correctly with images of various (reasonable) sizes. The instructor may try your code with his own image(s). There will be a follow up homework that deals with remote system monitoring based on this assignment. That future assignment will require you to monitor a constatny changing image and some parameters of a remote embedded system
Hints: wait for the image to be downloaded (class MediaTracker, page 444) before checking for its size. You can get the current size of the window in public void Paint(Graphics g) function, then do the calculations and paint everything. Read the image location in public static void main(String a[]) (application) and in public void init() (applet).
Attach all source code in files with proper names and extensions (*.html, *.java, *.pl, *.php, .htaccess e.t.c.). Do not ZIP files together or include compiled files (e.g. *.class). In case of dynamic Web pages (JavaScript or CGI) or Java applets also send the complete URL (including http://) that points to a page on your Web site that demonstrates your homework. Send your homework via e-mail to the instructor. Please set the message subject to: web-hw5.
Thank you.