Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » weird source of ActionEvent
weird source of ActionEvent [message #209742] Mon, 20 February 2006 14:07 Go to next message
Eclipse UserFriend
Originally posted by: jgreen.upb.de

Hi everyone,
I have a question concerning the result of the
ActionEvent.getSource()-Method. Shouldn't it be the Button, for example,
that I add the ActionListener to?

In my case I have a "FeedbackManager" to display some information, now
(in a third class) I can add an ActionListener to a clear-Button by calling

feedbackManager.getClearButton().addActionListener(actionLis tener);

Then, the source of my actionEvent is always just the instance of my
FeedbackManager instead of the Button.

Why is that so? What do I do if I need to distinguish between more Buttons?

I'm a bit confused!
Thanks for helping!

Joel
Re: weird source of ActionEvent [message #209781 is a reply to message #209742] Mon, 20 February 2006 17:14 Go to previous message
Eclipse UserFriend
Originally posted by: jgreen.upb.de

Problem explained:
I subclassed the Button in an anonymous inner class. Then probably the
source of the ActionEvent, set to "this" in Clickable, is being mixed up.

Still weird.

Joel


Joel Greenyer wrote:
> Hi everyone,
> I have a question concerning the result of the
> ActionEvent.getSource()-Method. Shouldn't it be the Button, for example,
> that I add the ActionListener to?
>
> In my case I have a "FeedbackManager" to display some information, now
> (in a third class) I can add an ActionListener to a clear-Button by calling
>
> feedbackManager.getClearButton().addActionListener(actionLis tener);
>
> Then, the source of my actionEvent is always just the instance of my
> FeedbackManager instead of the Button.
>
> Why is that so? What do I do if I need to distinguish between more Buttons?
>
> I'm a bit confused!
> Thanks for helping!
>
> Joel
Previous Topic:Can CompoundDirectedGraphLayout autoplace this?
Next Topic:Accessibility deviation
Goto Forum:
  


Current Time: Fri Mar 29 15:55:51 GMT 2024

Powered by FUDForum. Page generated in 0.03444 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top