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
component usesColor.BLACK
when setting up its border. What other colors can you get by name like this?- How would you create a
Color
object to represent purple? (Hint: Purple is made up of equal parts red and blue.)- What
Graphics
method would you use to draw a filled square?- What
Graphics
method 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.ClickMe
component.
- Modify
ClickMe
to draw a red square instead of a green spot.
- Modify
ClickMe
to display your name in purple instead of a green spot.
Remember that to compile and use the
ClickMe
component, you need the files,
ClickMe.java
, and
ClickMeApp.java
. You can run the program using the command
Spot.java
java ClickMeApp
.
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.