Please
UseCodeTags (← click) when posting code as it makes it easier for people to read your code. I've added them for you this time.
Your problem is variable 'x' is local to the actionPerformed method and so every time you press the button a new 'x' is being used which is initialized to 0 and hence the same colour. I suggest you make the 'x' variable an instance variable rather than a local method variable, ie move it out of the method.