# Drawing Shapes:

1. To draw shapes on a Graphics2S object, invoke the draw(Shape s) instance method.

 To find out more on the draw(Shape s) method, see doc for java.awt.Graphics2D: click here

2. Circles and Ovals:

• The class java.awt.geom.Ellipse2D contains 2 "inner classes" that are used to represent Ovals (a circle is an ovals)

• The inner class Ellipse2D.Double is used to define ellipse using measures in double typed values.

 Example: ``` Ellipse.Double A = new Ellipse.Double(x, y, width, height); *** x, y, width and height are double typed values. *** Use width == height to make a circle. ```

3. Inner classes:

Example of an inner class:
```   public class myClass
{
...variables...
...methods...

public class anotherClass  // <-- inner class
{
...inner class' variables
...inner class' methods
...inner class can also have inner classes...
}
}
```

 For now, just think of an inner class as a class with a longer name - detail much much later... BUT: you must only import the outer class:                                                             import java.awt.geom.Ellipse;

 Example: creating two Point objects p1 & p2 ``` Points2D.Double p1 = new Points2D.Double(x1, y1); Points2D.Double p2 = new Points2D.Double(x2, y2); ```
 Example: creating a Line objects "segment" First, define the end points of the line: ``` Points2D.Double p1 = new Points2D.Double(x1, y1); Points2D.Double p2 = new Points2D.Double(x2, y2); ``` Then, define the line segment using the points p1 and p2: ``` Line2D.Double segment = new Line2D.Double(p1, p2); ```
 Example: ``` Line2D.Double segment = new Points2D.Double(x1, y1, x2, y2); ``` Question: How is this done ?