public void executeClick(Point p, Drawing dwg) { if (dwg.getFrontmostContainer(p) != null) { // check to make sure there is a shape that contains the point dwg.getFrontmostContainer(p).setColor(myColor); } }
/** * 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()); }