I had to repaint after the animation because after the animation played my grid which was painted before hand disappears and I didn't know why so I just added it again which stopped this happening. All of this is under the paint method as the animation involves moving an oval downwards (the dropping of the counter in connect 4). This is called every time the mouse is clicked (the player takes their turn). The buffered image code is also under the paint method and update is called whenever repaint is called:
public void update(Graphics g1)
{
paint(g1);
}
I have called repaint under:
mousemoved to get x and move the counter above the grid (code shown above)
mouseclicked to make the new inserted counter appear in my grid
----Just found the problem!
I also had repaint under action listener which was supposed to be part of the animation code so I commented it and then commented the extra repaint I had after the animation code which got rid of the constant flickering (which is the program being repainted all the time) which occurred after the animation was played.
Now the flickering own happens during the animation as I am repainting the oval to move downwards and whenever I move the mouse (to move the counter that follows the mouse over the grid).
Wish this repainting weren't noticeable, but I have to repaint to show the updated image...Don't think theres anything else I could do? Would this be noticeable if I was on a faster computer?