• Post Reply Bookmark Topic Watch Topic
  • New Topic

Handling Events in Java..  RSS feed

 
Andy Richard
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just made my first event based GUI button, but i don't understand where i am going wrong.


 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does it compile? Does it run? Do you get error messages? If yes, then what are the error messages?

One problem: in line 20, it's not known what 'button' is. You declared a local variable named 'button' inside the perform() method, but that's not accessible outside the method. You'll need to make a member variable out of it instead of a local variable.
 
Andy Richard
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Jesper .. sorted that. button wasn't accessible!
due to that i was getting the error
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!