|
|
Start of Tutorial > Start of Trail > Start of Lesson |
Search
Feedback Form |
Use the API documentation for the Java 2 Platform to answer the following 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 of red and blue.)- Which
Graphicsmethod would you use to draw a filled square?- Which
Graphicsmethod would you use to draw text?
Use what you've learned from the preceding questions to make the following modifications to theCheck your answers.ClickMecomponent.
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.
- Modify
ClickMeto draw a red square instead of a green spot.
- Modify
ClickMeto display your name in purple instead of a green spot.
Remember, 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.