Welcome to the forum
See the Announcements page for the use of code tags.

"non-static variable button1 cannot be referenced from a static context"
I see no such problem in the code as posted