Shape Draw 1

Shape Class Hierarchy

  • Shape
    • Oval
    • Rectangle
    • Star
    • Polygon
    • Line
    • Text

Possibility 1

  • have a base shape class, and have this list as subclasses.
  • have shape contain all the data for all possible attributes.

Possiblity 2

  • Make getters and setters for all possible attributes, but don't store attributes you don't need.

Possiblity 3

  • General getters/setters based on Strings and objects.

Possiblity 4 ####

  • Only have 1 shapes class. Use an attribute to decide what kind of shape it is.

Shape Class Example

(see the PPT for code) * should extend serializable * actionPerformed: * if we're on top of something, highlight that thing and edit. * if we're not on top of something, make a new thing of that type * add the shape to the list of shapes * call rePaint to update the window graphics.

ShapeDraw GUI stuff

  • make sure text fields have handles

The Drawing Area

  • You make a draw method that you pass the graphics context to
  • the shapes draw themselves

Drawing Embellishments (highlighting)

  • Have the shape itself have a method called "drawEmbellishment" that will draw a rectangle with little squares on it (or whatever)
  • Also have a method for the shapes to draw themselves.

Drawing Data

  • Keep the current shapes in an ArrayList to keep track of them.