Hey,

You must put this code inside a method, a constructor!
Outside methods you can only declare attributes, for example a button.

I guess it will be solved with that... See you!