CS 111: Fundamentals of Programming I
Lab 10
Goals
The primary goal of this lab is to convert one of your Java application programs into an applet and to have
it execute from your web page.
Setting up your folder
- Choose one of your working Java programs that uses a GUI interface. Make a copy of the project folder and rename
the copy as Applet.
- Copy the BreezySwing folder from the course folder into the Applet folder.
Creating your HTML file
- If need be, review the Powerpoint slides on HTML.
- Use some simple text editor to create a file called myApplet.html. Your page should be in your Applet folder
and should include
- A brief bio of your self
- Home
- Family
- Education
- Hobbies and/or Interests
- List of courses (use list tags)
- Links to W&L home page and our course page
- An image - there is a Pictures folder in the course folder if you need it. Put the image file in the Applet
folder as well.
- A table of contents at the beginning with links to the sections of your page.
- Test your file by opening it with the Mozilla browser (or other browser if you are working elsewhere).
Changing your Java program
- Change GBFrame to GBApplet
- Take out any setTitle commands
- Change the constructor to public void init()
- Delete the entire method main
Try it out with appletviewer
- Use the right mouse button on your main class and choose "run applet"
- Choose "run applet in appletviewer"
Add applet to web page
- At the appropriate place in your html file add the Applet tags:
<APPLET CODE = yourprogname.class WIDTH= ? HEIGHT=?></APPLET> with actual values for the "yourprogname"
and the width and height.
- Save your file
Move your Applet folder into your public_html folder.
Note: It is best not to try to use BlueJ to work with projects that are in the public_html folder. Use BlueJ
on projects in your usual working directory and then move them to the public_html folder.
Try it out with browser
- Now try opening your HTML file with Mozilla
- If all goes well, your program should run on your web page
- You should be able to access this from anywhere on the internet using a url like
"http://www.cs.wlu.edu/~yourname/Applet/myApplet.html"
If all of this works
Show your working web page to the lab assistant or me so we can check you off as having completed the lab assignment.
Name:
Checked: