Hi Mary,
Originally posted by Mary Kate:
I want to know how this actionPerformed method is called.
This method is called by the operating system in response to the user doing something with the mouse or keyboard (and perhaps other input devices) on that button. In my experience I've never seen code written to call this method explicitly (if that is what you are wondering).
So for example if your program is running on Windows, and you click on a JButton with your mouse, Windows will talk to the JVM giving it details of what just happened. The JVM will build the ActionEvent object and pass it into this method. Then this method will run giving you the chance to do something in response to the user clicking the button.
Hope that gives you a bit of an idea.
Cheers, Jared.