Chapter 7: Problem 7
If you are writing an event listener class for a JButton component, what interface must the class implement? What method must the class have? When is this method executed?
Short Answer
Expert verified
Answer: A class must implement the ActionListener interface to be an event listener for JButton components. The required method, public void actionPerformed(ActionEvent e), is executed when the user clicks the JButton and triggers an action event.