public void paintComponent(Graphics g) {
   // In the paint method, all the shapes in ArrayList are
   // copied onto the canvas.
   g.setColor(getBackground());
   g.fillRect(0, 0, getSize().width, getSize().height);
   int top = shapes.size();
   for (int i = 0; i < top; i++) {
     Shape s = (Shape) shapes.get(i);
     s.draw(g);
   }
 }
 @Override
 protected void paintComponent(Graphics g) {
   for (Shape s : shapes) {
     s.draw(g);
   }
 }
 // ========================================================= drawCurrentShape
 private void drawCurrentShape(Graphics2D g2) {
   g2.setColor(_color); // Set the color.
   _shape.draw(g2, _start, _end); // Draw the shape.
 }