Computer Science Department, Bucknell University

Resources on Java Applets
CSCI 479 Fall 2009
Professor Dan Hyde

Java Applets are used to embed a Java program in a HTML document. Applets allow one to create interactive and sophisticated interfaces that run in a web browser.

It is relatively easy to transform a Java application into an Applet for use in a web browser as long as the Java application does not use external resources such as reading or writing local files.

I started with a Java Application for converting temperatures from Fahrenheit to Celcius and the other way as well. The Java Application uses the Swing library to create a GUI with two listeners on two JTextFields. Select link for code of TempConversion2.java.

I transformed the Java Application to an Java Applet called TempConvert.java. Select link for code of TempConvert.java. Note that I included comments on what I changed. Try it below.

Enter a value in either text field and press Enter.

If you are having problems seeing the Applet, you may have to turn on Java in your web browser or use a different web browser.

In the html code for this web page, I added the following html tags to include the applet:

<applet code = "TempConvert.class" width = "300" height = "80"></applet>


Reference: Chapter 23 in Java: How to Program by Dietel and Dietel, Eighth Edition.


On-line Resources for Java Applets
Page maintained by Dan Hyde, hyde at bucknell.edu Last update October 4, 2009
Back to CSCI 479's home page.