0
public class Square extends JButton {   
    ... 
}

What's the best way for a JButton to handle a MouseClick that changes the background color of itself? Do I want to add/overwrite an ActionListener/MouseListener/etc?

sir_thursday
  • 5,270
  • 12
  • 64
  • 118

1 Answers1

2

Yes, you will need to add an ActionListener and do your mumbo-jumbo in actionPerformed(). Use the setBackground() to change the background color. :)

An SO User
  • 24,612
  • 35
  • 133
  • 221