Simply create an ActionListener instance and add that instance to every button using the addListener() method.
What is it that you're trying to do?
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Joined: Dec 16, 2010
I know, how to do as you suggested. for each button individually.
But I want to write only once for JPanel which is the container.
for example, I have 70 or 80 buttons in JPanel and it's hard to add that instance for each button individually.
then I want to do something with JPanel which contains all buttons. when you click on JPanel or it's content components, a JOptionPane show be show to tell you that this part of application is under construction. or this part of application is not working.
but as you suggested, I have tried that with Screen Keyboard.