public void resizeBox(int x,int y,int dx,int dy,int limitX1,int limitY1,int limitX2,int limitY2,int cornerBoundary){
  _x1=limitX1;
  _x2=limitX2;
  _y1=limitY1;
  _y2=limitY2;
  if (Math.abs(x - x1) < cornerBoundary && Math.abs(y - y1) < cornerBoundary) {
    if (checkLimit(cornerBoundary) && dx > 0)     dx=0;
    if (checkLimit(cornerBoundary) && dy > 0)     dy=0;
    moveCorner(AREA.TL,dx,dy);
  }
 else   if (Math.abs(x - x2) < cornerBoundary && Math.abs(y - y1) < cornerBoundary) {
    if (checkLimit(cornerBoundary) && dx < 0)     dx=0;
    if (checkLimit(cornerBoundary) && dy > 0)     dy=0;
    moveCorner(AREA.TR,dx,dy);
  }
 else   if (Math.abs(x - x1) < cornerBoundary && Math.abs(y - y2) < cornerBoundary) {
    if (checkLimit(cornerBoundary) && dx > 0)     dx=0;
    if (checkLimit(cornerBoundary) && dy < 0)     dy=0;
    moveCorner(AREA.BL,dx,dy);
  }
 else   if (Math.abs(x - x2) < cornerBoundary && Math.abs(y - y2) < cornerBoundary) {
    if (checkLimit(cornerBoundary) && dx < 0)     dx=0;
    if (checkLimit(cornerBoundary) && dy < 0)     dy=0;
    moveCorner(AREA.BR,dx,dy);
  }
 else   if (x > x1 && x < x2 && y > y1 && y < y2) {
    if ((x1 <= limitX1 && dx < 0) || (x2 >= limitX2 && dx > 0))     dx=0;
    if ((y1 <= limitY1 && dy < 0) || (y2 >= limitY2 && dy > 0))     dy=0;
    moveBox(dx,dy);
  }
}

public void resizeBox ( int x , int y , int dx , int dy , int limitX1 , int limitY1 , int limitX2 , int limitY2 , int cornerBoundary ) { _x1 = limitX1 ; _x2 = limitX2 ; _y1 = limitY1 ; _y2 = limitY2 ; if ( Math . abs ( x - x1 ) < cornerBoundary && Math . abs ( y - y1 ) < cornerBoundary ) { if ( checkLimit ( cornerBoundary ) && dx > 0 ) dx = 0 ; if ( checkLimit ( cornerBoundary ) && dy > 0 ) dy = 0 ; moveCorner ( AREA . TL , dx , dy ) ; } else if ( Math . abs ( x - x2 ) < cornerBoundary && Math . abs ( y - y1 ) < cornerBoundary ) { if ( checkLimit ( cornerBoundary ) && dx < 0 ) dx = 0 ; if ( checkLimit ( cornerBoundary ) && dy > 0 ) dy = 0 ; moveCorner ( AREA . TR , dx , dy ) ; } else if ( Math . abs ( x - x1 ) < cornerBoundary && Math . abs ( y - y2 ) < cornerBoundary ) { if ( checkLimit ( cornerBoundary ) && dx > 0 ) dx = 0 ; if ( checkLimit ( cornerBoundary ) && dy < 0 ) dy = 0 ; moveCorner ( AREA . BL , dx , dy ) ; } else if ( Math . abs ( x - x2 ) < cornerBoundary && Math . abs ( y - y2 ) < cornerBoundary ) { if ( checkLimit ( cornerBoundary ) && dx < 0 ) dx = 0 ; if ( checkLimit ( cornerBoundary ) && dy < 0 ) dy = 0 ; moveCorner ( AREA . BR , dx , dy ) ; } else if ( x > x1 && x < x2 && y > y1 && y < y2 ) { if ( ( x1 <= limitX1 && dx < 0 ) || ( x2 >= limitX2 && dx > 0 ) ) dx = 0 ; if ( ( y1 <= limitY1 && dy < 0 ) || ( y2 >= limitY2 && dy > 0 ) ) dy = 0 ; moveBox ( dx , dy ) ; } }
resize box , move box and move corner , constrained by the boundary
