private static void addHorizontalSmallSpring(Path2D.Float path,int y0,int x1,int x2){
  int springHeight=2;
  int springWidth=2;
  int distance=Math.abs(x2 - x1);
  int numSprings=(distance / (springHeight));
  int leftOver=(distance - (numSprings * springHeight)) / 2;
  path.lineTo(x1,y0);
  path.lineTo(x1 - leftOver,y0 - leftOver);
  int count=0;
  if (x1 > x2) {
    for (int x=x1 - leftOver; x > x2 + leftOver; x-=springHeight) {
      int y=(count % 2 == 0) ? y0 - springWidth : y0 + springWidth;
      path.lineTo(x,y);
      count++;
    }
  }
 else {
    for (int x=x1 + leftOver; x < x2 - leftOver; x+=springHeight) {
      int y=(count % 2 == 0) ? y0 - springWidth : y0 + springWidth;
      path.lineTo(x,y);
      count++;
    }
  }
  path.lineTo(x2 + leftOver,y0);
  path.lineTo(x2,y0);
}

private static void addHorizontalSmallSpring ( Path2D . Float path , int y0 , int x1 , int x2 ) { int springHeight = 2 ; int springWidth = 2 ; int distance = Math . abs ( x2 - x1 ) ; int numSprings = ( distance / ( springHeight ) ) ; int leftOver = ( distance - ( numSprings * springHeight ) ) / 2 ; path . lineTo ( x1 , y0 ) ; path . lineTo ( x1 - leftOver , y0 - leftOver ) ; int count = 0 ; if ( x1 > x2 ) { for ( int x = x1 - leftOver ; x > x2 + leftOver ; x -= springHeight ) { int y = ( count % 2 == 0 ) ? y0 - springWidth : y0 + springWidth ; path . lineTo ( x , y ) ; count ++ ; } } else { for ( int x = x1 + leftOver ; x < x2 - leftOver ; x += springHeight ) { int y = ( count % 2 == 0 ) ? y0 - springWidth : y0 + springWidth ; path . lineTo ( x , y ) ; count ++ ; } } path . lineTo ( x2 + leftOver , y0 ) ; path . lineTo ( x2 , y0 ) ; }
add an horizontal spring between ( x1 , y0 ) and ( x2 , y0 ) to the given path object
