LAB 39 – Applets

Lab Exercises

Topics

n      To write an Applet that can be accessd via the Internet

n      To use the BlueJ IDE to write and test the applet

 

Using BlueJ to start a new applet

1)       Starting BlueJ - double-click icon.

2)       Creating a new project - select New Project from the Project menu and save the project as Applet.

3)       Click on New Class and type Shapes as the class name and select Applet as the class type

4)       Right-click on the Shapes class and select Open Editor

5)       Review the default code generated by BlueJ.

6)       Modify the code generated by BlueJ so that the comments are yours.

7)       Compile the applet and fix any errors that occur.

8)       To run the program, right-click on the Shapes class and select Run Applet

a)       This should pop-up a terminal window with results

 

9)       Change the color of the rectangle to blue

10)   Change the color of the first text to yellow and replace “Sample Applet” with your name.

11)   Change the color of the second text to red and replace "created by BlueJ" with something clever.

12)   Use drawOval, fillOval, and drawRect to draw three additional shapes, each with a different color in different locations in the applet window.

 

 

 

QUESTIONS: Submit Shapes.java to the DropBox in WebCT.