public void addKnot(int x,int color){
  int[] nx=new int[numKnots + 1];
  int[] ny=new int[numKnots + 1];
  System.arraycopy(xKnots,0,nx,0,numKnots);
  System.arraycopy(yKnots,0,ny,0,numKnots);
  xKnots=nx;
  yKnots=ny;
  xKnots[numKnots]=x;
  yKnots[numKnots]=color;
  numKnots++;
  sortKnots();
  rebuildGradient();
}

public void addKnot ( int x , int color ) { int [ ] nx = new int [ numKnots + 1 ] ; int [ ] ny = new int [ numKnots + 1 ] ; System . arraycopy ( xKnots , 0 , nx , 0 , numKnots ) ; System . arraycopy ( yKnots , 0 , ny , 0 , numKnots ) ; xKnots = nx ; yKnots = ny ; xKnots [ numKnots ] = x ; yKnots [ numKnots ] = color ; numKnots ++ ; sortKnots ( ) ; rebuildGradient ( ) ; }
add a new knot .
