February 2014
Beginner
1248 pages
62h 25m
English
13.31 Java 2D introduces many new capabilities for creating unique and impressive graphics. We’ll add a small subset of these features to the drawing application you created in Exercise 12.17. In this version, you’ll enable the user to specify gradients for filling shapes and to change stroke characteristics for drawing lines and outlines of shapes. The user will be able to choose which colors compose the gradient and set the width and dash length of the stroke.
First, you must update the MyShape hierarchy to support Java 2D functionality. Make the following changes in class MyShape:
a) Change abstract method draw’s parameter type from Graphics to Graphics2D.
b) Change all variables ...
Read now
Unlock full access