goURL.java
This applet gets the Web site names and URLs from the applet parameters and allows visitors to click on a site from the drop down box; the applet then takes them to the selected site instantly. While you could use simple HTML/JavaScript to do the same thing, this applet is an excellent project with which to learn Java. Since you have the source, you can practice adding your own parameters to the applet, such as background color, background image, etc.
Usage: Download goURL.class, and place it in the same directory as your Web page.
Java Source: goURL.java
HTML Source:
<applet code="goURL.class" width=130 height=30>
<PARAM name="page0" value="Java Homepage">
<PARAM name="url0" value="http://www.javasoft.com">
<PARAM name="page1" value="Java Boutique">
<PARAM name="url1" value="http://www.javaboutique.com">
<PARAM name="page2" value="Sun Homepage">
<PARAM name="url2" value="http://www.sun.com">
<PARAM name="page3" value="Java World">
<PARAM name="url3" value="http://www.javaworld.com">
<PARAM name="page4" value="Cafe Au Lait">
<PARAM name="url4" value="http://sunsite.unc.edu/javafaq/">
<PARAM name="page5" value="WebDeveloper.com">
<PARAM name="url5" value="http://www.webdeveloper.com">
</applet>
Author: Michael Shipp
|