Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Member object talks back to parent object

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
found the solution, detailed in

https://coderanch.com/t/530049/java/java/Communication-between-EJB-its-container
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
But why did you start a new thread. Closing thread.
    Bookmark Topic Watch Topic
  • New Topic