public void mouseReleasedEventHandler(MouseEvent me) {
      if(pressed) {
      	if(type == 1) {
      	  index = 0;
      	}else {
          endX = me.getX();
          endY = me.getY();
          if(type == 2 || type == 3) {
            width = Math.abs(startX - endX);
            height = Math.abs(startY - endY);
            if(endX<=startX) {
              startX = endX;
            }
            if(endY<=startY) {
              startY = endY;
            }
          }
       }
        pressed = false;
        repaint();
      }    	
    }