Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Use the API documentation for the Java 2 Platform 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?
Now, use what you learned from the javadocs to make the following modifications to theCheck your answers.ClickMe
applet. To compile this program, you also need thefile.
Spot.java
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 point 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.
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2002 Sun Microsystems, Inc. All rights reserved.