@Override protected void paintComponent(Graphics g){
  int fadeX=0;
  int blankX=getWidth() / 3;
  int bigRectW=getWidth() / 3;
  g.setColor(largeRectColors[colorIndex]);
  g.fillRect(0,0,bigRectW,getHeight());
  g.setColor(Color.WHITE);
  g.fillRect(bigRectW,0,bigRectW,getHeight());
  int bigRectX=2 * bigRectW;
  int smallRectW=4;
  int smallRectH=4;
  int smallRectX=bigRectX + (bigRectW / 2) - (smallRectW / 2);
  int smallRectY=(getHeight() / 2) - (smallRectH / 2);
  g.setColor(Color.BLACK);
  g.fillRect(2 * getWidth() / 3,0,getWidth() / 3,getHeight());
  g.setColor(smallRectColors[colorIndex]);
  g.fillRect(smallRectX,smallRectY,smallRectW,smallRectH);
}

@ Override protected void paintComponent ( Graphics g ) { int fadeX = 0 ; int blankX = getWidth ( ) / 3 ; int bigRectW = getWidth ( ) / 3 ; g . setColor ( largeRectColors [ colorIndex ] ) ; g . fillRect ( 0 , 0 , bigRectW , getHeight ( ) ) ; g . setColor ( Color . WHITE ) ; g . fillRect ( bigRectW , 0 , bigRectW , getHeight ( ) ) ; int bigRectX = 2 * bigRectW ; int smallRectW = 4 ; int smallRectH = 4 ; int smallRectX = bigRectX + ( bigRectW / 2 ) - ( smallRectW / 2 ) ; int smallRectY = ( getHeight ( ) / 2 ) - ( smallRectH / 2 ) ; g . setColor ( Color . BLACK ) ; g . fillRect ( 2 * getWidth ( ) / 3 , 0 , getWidth ( ) / 3 , getHeight ( ) ) ; g . setColor ( smallRectColors [ colorIndex ] ) ; g . fillRect ( smallRectX , smallRectY , smallRectW , smallRectH ) ; }
displays our component with the animating colors of the areas on the left and right , separated by an area of white in the middle
