Add a mouse listener to the component that is being clicked on. In the listener method, set the color.