The previous replies answered the question correctly.
As an American living in Mexico, I can add this personal perspective:
I have almost never heard the term "beaner" used by anyone in the U.S. However, the word "gringo" is use very frequently in Mexico. I also believe that "beaner" is a more offensive term than "gringo", as a matter of fact I do not find it offensive at all when people refer to me as a "gringo".