private void moveShapes(MouseEvent me){
      //Check if this mouse clicked on a Shape object
      Object ob=me.getSource();
      if(!(ob instanceof Shape)) return;
      //get the translation of the mouse cursor
      int dx=me.getX()-lastX, dy=me.getY()-lastY;
      
      int modifier=me.getModifiers();
      Shape s=(Shape) ob;
      switch(modifier){
          //Using the left mouse button to move a single shape  
          case MouseEvent.BUTTON1_MASK:                              
              s.moveBy(dx, dy);              
              break;             
          //Using the right mouse button to move all the selected shapes
          case MouseEvent.BUTTON3_MASK:
              if(s.getSelectState()) moveSelectedShapes(dx, dy);         
      }
      lastX=me.getX();
      lastY=me.getY();
  }