Answers to Self-Review Exercises
a) setStroke, Graphics2D
.
b) GradientPaint
.
c) drawLine
.
d) red, green, blue.
e) points.
f) TexturePaint
.
a) False. The first two arguments specify the upper-left corner of the bounding rectangle.
b) True.
c) True.
d) True.
e) False. Font sizes are measured in points.
f) False. The coordinate (0,0) corresponds to the upper-left corner of a GUI component on which drawing occurs.
a) The setFont
method takes a Font
object as an argument—not a String
.
b) The Graphics
class does not have an erase
method. The clearRect
method should be used.
c) Font.BOLDITALIC
is not a valid font style. To get a bold italic font, use Font.BOLD + Font.ITALIC
.
d) Method setColor
takes a Color
object as an argument, not ...
Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.