Write a program that can be run both as an application and an applet. Post the applet (but not its source code!) on your Web site. The program should download an image from the Internet (not from local hard drive!) and display it in the center of the window. In case of resizing the window, the image should be recentered.
In application mode - the image location should be read from a command line paramenter. In applet mode - the image location should be read from a parameter called "display". In case the command line or applet parameter is not defined, a default location that is encoded inside the program must be used.
In addition to drawing an image your program should draw two diagonal lines, a central horizontal and a central vertical lines on the top of 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).
Hints: wait for the image to be downloaded (class MediaTracker,
pages 349, 352) 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-hw4.
Thank you.