![]() ![]() ![]() |
Start of Tutorial > Start of Trail > Start of Lesson | Search |
Questions
Use the javadocs to answer these questions:
- The ClickMe applet uses
Color.red
to set the drawing color to red. What other colors can you get by name like this?- How would you specify other colors, like purple?
Exercises
Now, use what you learned from the javadocs to make the following modifications to theClickMe
applet.
Note: This is an exercise in reading code, making guesses, and looking up classes and methods in the javadocs. We haven't yet given you any detailed information about how to write Java code and what it all means. But you might be surprised at how much you can intuit from the code. The main pont of this exercise is to get you to use the javadocs and to read code. Do not worry if you cannot get your solution to work. Do not worry if your solutions do not match ours. Do compare your solutions to ours so that you can get more experience reading code and perhaps learn more about the API in the Java platform.
- Modify the applet to draw a green square instead of a red spot.
- Modify the applet to display your name in purple instead of a red spot.
Extra Credit Exercises
Use the javadocs to find information to help you make these modifications to theCheck your answers.ClickMe
applet.
- Modify the applet to erase the red spot instead of redrawing the whole applet.
- Modify the applet to drag the red spot when the mouse is held down.
Hint: For this exercise, start with the result from the previous exercise (erasing the spot rather than redrawing the applet).
![]() ![]() ![]() |
Start of Tutorial > Start of Trail > Start of Lesson | Search |