Hi,
I'm going through java swing tutorials here, and there's a line I don't understand:
JButton button = new JButton("Click me"); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tf.setText("Welcome to swing"); } });
Can someone please explain to me how you can define a method there? I've not come across this sort of definition before. Thanks