Reputation: 3922
I implemented class MyButton, which extends class Jcomponent. And the problem is, that i have some MyButton objects in main class (implements ActionListener), and I would like to add action listener to them.
How to handle it? So i can use addActionListener?
Thanks in advance
Upvotes: 1
Views: 891
Reputation: 109823
use MouseListener / KeyBindings in the case MyButton objects
doesn't implements / inherits JButton
or AbstractButton
methods
if implements JButton
or AbstractButton
then you can use
a) ButtonModel
b) Swing Action
c) ActionListener
for better help sooner post an SSCCE
Upvotes: 3