How does Java know when a JButton has been pressed?
I'm learning Java Swing and trying to understand how event handling works. In this code, the frame implements ActionListener and registers itself with button.addActionListener(this). When the button is…