This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Your problem boils down to one major "oops". In your class method that changes the color.... take a look... a CLOSE look at exactly WHAT is getting set with the value of what! Hint.... you are setting the value of the argument with the current value of the int. To research this part, look up some info on "assignment" and I think you'll find the key.
The reason that it works in the second example is that, in the same handler as above, you are returning the value of the argument that you passed in NOT the value of the int. It will always pass back what you passed in.
Read this, take another look at these areas, and I think you'll find your answer!
Best of luck.
SCJP - 86% - June 11, 2009