Win a copy of Clojure in Action this week in the Clojure forum!
    Bookmark Topic Watch Topic
  • New Topic

Member object talks back to parent object

 
Dave Elwood
Ranch Hand
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am in a situation where I have two classes AA and BB,
where "BB bb;" is a member of AA aa.

I wish to send info from the interior of class BB up to class AA.

Note the direction - from AA to BB is easy, since bb is a member of aa, but talking back to aa??

Using events? All literature I find about events deals with Keyboard events, Timer events, Mouse events, all induced by external actions. Nothing about my own custom-made 'burp' events, induced by the code in the BB object.

Is there a method other than using events for a member object to communication with its parent object?
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12021
25
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
your terminology is confusing. 'parent' usually refers to an inheritance relationship:


Member object usually refers to a class being a member variable of another class:



In the second case, it would be very dangerous to expect to be able to do this. How do you know if the member variable is actually in a container class? What if it is in two or more? What if it is one minute, but not the next?
 
Dave Elwood
Ranch Hand
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Yes, my terminology is really for the birds, but whence the worry about membership in a container class??
It doesn't really seem realistic to me.

(And I solved the custom event problem in the meantime)

Anyway this is the scenario.

1. BB bb is a member of AA aa

2. and AA aa is a member of main()

3. In the future AA will be a form with text boxes and a panel and
the class BB will be the code behind the panel (so BB is a member of AA).
I want a change in the panel code to fill in a text box in the AA form when circumstances demand it

This is main()

This is AA

This is BB

These are BurpEvent, BurpListener and MyBurpListener from three files

all the nifty event code is from http://www.exampledepot.com/egs/java.util/custevent.html
>
 
Dave Elwood
Ranch Hand
Posts: 84
 
Campbell Ritchie
Sheriff
Pie
Posts: 47279
52
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
But why did you start a new thread. Closing thread.
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic