View RSS Feed

Java AWT

Drawing an Arc

Rate this Entry
by , 03-06-2012 at 07:54 PM (905 Views)
A piece of ellipse is drawn by Arc2D. Following present an arc class.
  • A bounding rectangle
  • An angular extent
  • A start angle
  • A closure type


An ellipse in float & double precision are specified.
  • Arc2D.Double
  • Arc2D.Float


Arc2D class defines 3 types of arcs:
  • OPEN
  • CHORD
  • PIE


The parameters and size of the arc are set by applying these different methods:
  • By supplied Dimension2D and Point2D.
  • Directly by coordinates.
  • By copying Arc2D that is already existing.


An arc creation is explained by this code given below.
Java Code:
// draw Arc2D.Double
g2.draw(new Arc2D.Double(x, y,
                         rectwidth,
                         rectheight,
                         90, 135,
                         Arc2D.OPEN));

Submit "Drawing an Arc" to Facebook Submit "Drawing an Arc" to Digg Submit "Drawing an Arc" to del.icio.us Submit "Drawing an Arc" to StumbleUpon Submit "Drawing an Arc" to Google

Categories
Graphics

Comments