Padawan
2009-06-12 12:27:38 UTC
commonButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
label.setText("JButton clicked");
}});
Please help me understand what this chunk of code is doing. It looks like ActionListener() is being passed as the argument to the addActionListener method, but I'm not clear on how/why we also pass what looks like a complete method as well, and why this wouldn't be separated somewhere else.
Hope this makes sense. I'm still learning and have a long way to go, and I'll appreciate the help. Thanks