I have 4 lists of buttons arranged into a column in my program. As of now I have 4 loops that check to see if a button has been clicked or not. Is there a simple way to chec
Any time you click a button, it triggers the actionPerformed method, regardless of which button you pressed.
actionPerformed
public void actionPerformed(ActionEvent event) { Object source = event.getSource(); if (source instanceof JButton) System.out.println("You clicked a button!"); }