Java-Swing: Change getSource() in ActionListener
Posted
by Brandon
on Stack Overflow
See other posts from Stack Overflow
or by Brandon
Published on 2010-04-20T03:19:59Z
Indexed on
2010/04/20
3:23 UTC
Read the original article
Hit count: 527
I have a class that contains a JButton. This can't be changed.
The problem is this: The actionListener calls getSource() and gets the JButton, not the container class.
Can I change what getSource retrieves, before the actionListener is added? OR can JButtons have a variable reference to its container?
I can't make a class extend a JButton. It caused bugs for drawing purposes... story of my week.
© Stack Overflow or respective owner