View RSS Feed

Java AWT

Drawing a Rectangle

Rate this Entry
by , 03-06-2012 at 07:51 PM (615 Views)
RectangularShape class implements the shape interface, in which few more methods are added of its own.
Such methods are used to find out certain information regarding the size and location of shape so that to find out the rectangle’s center point and to set the shape’s bounds.

Dimension w,x,h and location x,y defines a rectangle. These given methods specify rectangle in float or double precision.

  1. Rectangle2D.Double
  2. Rectangle2D.Float

Creation of a rectangle is explained by this given code.
Java Code:
// draw Rectangle2D.Double
g2.draw(new Rectangle2D.Double(x, y,
Consider these parameters to specify rounded rectangles:
  • Width
  • Location
  • Height
  • Height of the corner arc
  • Width of the corner arc

Submit "Drawing a Rectangle" to Facebook Submit "Drawing a Rectangle" to Digg Submit "Drawing a Rectangle" to Submit "Drawing a Rectangle" to StumbleUpon Submit "Drawing a Rectangle" to Google