protected Point2D correct(Point2D anchor,Rectangle2D bounds){
  if (anchor == null)   return anchor;
  double x=anchor.getX(), y=anchor.getY();
  double x1=bounds.getMinX(), y1=bounds.getMinY();
  double x2=bounds.getMaxX(), y2=bounds.getMaxY();
  x=(x < x1 ? x1 : (x > x2 ? x2 : x));
  y=(y < y1 ? y1 : (y > y2 ? y2 : y));
  m_tmp.setLocation(x,y);
  return m_tmp;
}

protected Point2D correct ( Point2D anchor , Rectangle2D bounds ) { if ( anchor == null ) return anchor ; double x = anchor . getX ( ) , y = anchor . getY ( ) ; double x1 = bounds . getMinX ( ) , y1 = bounds . getMinY ( ) ; double x2 = bounds . getMaxX ( ) , y2 = bounds . getMaxY ( ) ; x = ( x < x1 ? x1 : ( x > x2 ? x2 : x ) ) ; y = ( y < y1 ? y1 : ( y > y2 ? y2 : y ) ) ; m_tmp . setLocation ( x , y ) ; return m_tmp ; }
corrects the anchor position , such that if the anchor is outside the layout bounds , the anchor is adjusted to be the nearest point on the edge of the bounds .
