Hello,
Working on the Try It section from Lesson 11, I am trying to get the name of the button that triggered the mouseClicked() method. I figured I could use java.awt.Component.getName(), like this:
Code:
public void mouseClicked(MouseEvent e) {
javax.swing.JButton currentButton = (JButton)e.getComponent();
System.out.println(currentButton.getName());
if (currentButton.getText() == ""){
....
but the result I get is null.
Would you please help me understand what is going on?