public void executePress(Point p, Drawing dwg) {
   // Get the color we want the ellipse to have from the drawing
   Color c = dwg.getColor();
   // Create the ellipse and store it in the instance variable
   s = new Ellipse(p.x, p.y, 0, 0, c);
   // Store the starting click point oP
   oP = p;
   // Add the ellipse to the drawing
   dwg.add(s);
   // Record history
   dwg.recordHistoryItem(new HistoryAction(s, dwg, false));
 }
예제 #2
0
 /**
  * On click, if a shape has been clicked, change its color to the Drawing object's current set
  * color.
  */
 public void executeClick(Point p, Drawing dwg) {
   Shape clickedShape = dwg.getFrontmostContainer(p);
   if (clickedShape != null) clickedShape.setColor(dwg.getColor());
 }