|
|
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
ClickMecomponent usesColor.BLACKwhen setting up its border. What other colors can you get by name like this?- How would you create a
Colorobject to represent purple? (Hint: Purple is made up of equal parts red and blue.)- What
Graphicsmethod would you use to draw a filled square?- What
Graphicsmethod would you use to draw text?
Note: The point of these exercises is to encourage you to read code and to use the API documentation. We haven't yet given you any detailed information about how to write code, but you might be surprised at how much you can do.
Use what you learned from the preceding questions to make the following modifications to theCheck your answers.ClickMecomponent.
- Modify
ClickMeto draw a red square instead of a green spot.
- Modify
ClickMeto display your name in purple instead of a green spot.
Remember that to compile and use the
ClickMecomponent, you need the filesClickMe.java,
ClickMeApp.java, and
Spot.java. You can run the program using the command
java ClickMeApp.
|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.