private void resetShapeBounds(){
  RoundRectangle2D.Double rrect=(RoundRectangle2D.Double)shape;
  rrect.setRoundRect(0,0,getBounds().width - 1,getBounds().height - 1,10,10);
}

private void resetShapeBounds ( ) { RoundRectangle2D . Double rrect = ( RoundRectangle2D . Double ) shape ; rrect . setRoundRect ( 0 , 0 , getBounds ( ) . width - 1 , getBounds ( ) . height - 1 , 10 , 10 ) ; }
rests the boundaries of the shape which is drawn as the rubberband . the boundaries of the shape need to be set so that when drawn they lie just inside the boundaries of the component on all four sides .
