Hello there! I'm new to this any trying to get a GUI sorted out. I've been trying to do Event Handlers but for some reason, I keep getting an error saying the variable can't be found. My code is below:
You would have been better to post on the Swing Forum, but the problem is that the JButton you are calling the action on is declared as a local variable, so it is out of scope when you get to the actionPerformed method.
Campbell Richie, thank you. I've realised (Apparently my spelling of 'realized' isn't right =]) the error of my ways. I declared the button globally. Sorry about posting in wrong section, first post so forgive me please =].
Oops.. Sorry about spelling your name wrong also. Yea', all is working now, declared all the 'JButtons' globally so that all my methods can use them. I really should of noticed that =]
Everybody declares things as local variables from time to time. Don't call them "global" however. That is a C/C++ concept; a C "global" is "visible" to any code in the application. In OO programming you want to declare your fields as "private" so they are only visible within your class.
And no problem about the other things you mentioned!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.