private Point calculateLocation(int position,Rectangle bounds,Dimension size,int offset){
  Point location=new Point();
  location.x=bounds.x - horizontalMoveDirection * HORIZONTAL_MARGIN;
  location.y=bounds.y;
  if (position == 1 || position == 3) {
    location.x+=(bounds.width - size.width);
  }
  if (position == 2 || position == 3) {
    location.y+=(bounds.height - size.height);
    offset=-offset;
  }
  location.y+=offset;
  return location;
}

private Point calculateLocation ( int position , Rectangle bounds , Dimension size , int offset ) { Point location = new Point ( ) ; location . x = bounds . x - horizontalMoveDirection * HORIZONTAL_MARGIN ; location . y = bounds . y ; if ( position == 1 || position == 3 ) { location . x += ( bounds . width - size . width ) ; } if ( position == 2 || position == 3 ) { location . y += ( bounds . height - size . height ) ; offset = - offset ; } location . y += offset ; return location ; }
calculates the location within the bounds to display something with the given size , so it appears at the given position , which is in one of the four corners ( 0 : top - left , 1 : top - right , 2 : bottom - left , 3 : bottom - right ) .
