public void mouseReleased(MouseEvent e) {
      if (currentElement == null) return;
      if (currentElement instanceof Spring) {
         MyWorldView.SPACE_INVERSE_TRANSFORM.transform(e.getPoint(),p);

          // we dragged a spring, so we look for and attachable element near by  
         SpringAttachable element = world.findAttachableElement(p.getX());
         if (element != null) {
            // we dragged a spring and it is near an attachable element,
            // so we hook it to a spring end.
            Spring spring = (Spring) currentElement;
            double a=spring.getAendPosition();
            if (a==p.getX())
               spring.attachAend(element);
            double b=spring.getBendPosition();
            if (b==p.getX())
               spring.attachBend(element);
          }
      }    
 //     currentElement.setReleased();
 //     currentElement = null;
      world.repaintView();
   }