Graphic by Keith Ohlfs |
|
Today in lab you will learn how to use the Symantec project
manager to put together and run a basic graphics applet, using
the java awt. We will first download a pre-written applet,
Smiley, from the download subdirectory of cs111 on nike. This
applet makes a happy face that looks like this:
Together we will modify this applet, to look like this:
When programming in Java, you will often make mistakes typing or in designing your program code. These mistakes will lead to two types of errors: Compiler errors, which cause error messages during the compilation of your program, and run-time errors, which allow the program to compile, but cause it to do the wrong thing. These errors are often called "bugs". Knowing how to find and correct bugs in your code (known as debugging) is an extremely important skill for a programmer. We will examine some common types of errors.
Now that you've had a chance to modify and debug some
code, it's time to try it on your own. Modify the Grump
project so that the mouth is changed to an oval shape and
add a blue hat to the head. Change the text to say "Have
a Surprising Day!" Now create a duplicate surprise face
next to the original, only make it half the size. Do this using
"straight line code". Do not use methods, which will be
discussed on Tuesday. The final applet should produce something
like this:
For more help on using the project manager, check out the Project Manager Help in the documentation page.