It wont work that way. What you need is a relation between your "object" and it's colour. You cannot access a variables name. Have a look at HashMap<String, String>, use the Object as the key and...