Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

button.addActionListener(this) and static methods

843807Apr 29 2005 — edited May 1 2005
I'm trying to make a gui program in which the gui is set up in the main method. Everything works fine except for the button I use. When I try to add it to the actionListener, I get the error "non-static variable this cannot be referenced from a static context". How can I work around this?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 29 2005
Added on Apr 29 2005
4 comments
1,063 views