Sams Teach Yourself Java 2 in 24 Hours

Sams Teach Yourself Java 2 in 24 Hours

By Rogers Cadenhead

Q&A

  1. How can I draw arcs that go clockwise rather than counterclockwise?

    You can accomplish this by specifying the size of the arc as a negative number. The arc will begin at the same point, but go in the opposite direction in an elliptical path. For example, the following statement draws an open arc at (35,20) that is 90 degrees long, begins at the 0 degree mark, goes clockwise, and has a height of 20 and a width of 15:

    Arc2D.Float smile = new Arc2D.Float(35F, 20F, 15F, 20F, 
        0F, -90F, Arc2D.Float.OPEN); 
  2. Ellipses and circles don't have corners. What are the (x,y) coordinates specified with the Ellipses.Float constructor method?

    The (x,y) coordinates represent the smallest x value and smallest y value of the oval or circle. If you drew an invisible rectangle around it, the upper-left corner of the rectangle would be the x and y coordinates used as arguments to the method.

Share ThisShare This

Informit Network