How does the 'actionPerformed' method get called without an explicit call to it?
问题 I just started learning GUI with Swing and don't exactly understand how the actionPerformed method works. Consider the following code: //code to create a button and change its text when clicked public class simplegui implements ActionListener { JButton button; public static void main(String[] args) { simplegui gui=new simplegui(); gui.go(); } public void go() { JFrame frame=new Frame(); button=new JButton("click Me"); button.addActionListener(this); frame.getContentPane().add(button); frame