Please see my comment to the question. When you say that you "don't know how to write your code", you probably already over-estimate your knowledge. You don't know something else. You don't know that the button and any other UI elements have nothing to do with "background" or "foreground". You don't even understand that buttons are not programmed to carry any functionality bound to their clicks.
You request is simply beyond the help that would satisfy you, not mentioning your ability to write the application immediately after getting any help. First, you should learn how to get help.
You main problem is that you failed to isolate description of required functionality form your idea on how it should be achieved. The problem is not that your ideas are wrong or right; the problem is that you cannot see the boundary between reality and your understanding if this reality, trying to base your question on some ideas you are preoccupied with, no matter right or wrong (and in this very case it looks they are wrong).
First of all, you would need to share your ultimate
goals. Not just explain what you want to achieve, explain why. Don't apply any constraints to the advice, as you don't understand if they are valid or wrong.
Embrace the idea that your "I want" is not really about "possible" or "impossible". Generally, the statements are not classified into "true" and "false", not even close to that. Remember that statements involve real-life language. So, they are roughly classified into "true", "false" and "gibberish", see http://en.wikipedia.org/wiki/Gibberish
Please, read the rules for asking questions at http://en.wikipedia.org/wiki/Gibberish
See also this discussion: How to ask a good question?
] (not just my answer but the whole discussion).
Please also see my explanation of the related issue: what is the difference between the class and encapsulation in programming