Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Reference to an Instianted Object

Status
Not open for further replies.

jsulman

Programmer
Jun 14, 2001
85
US
How do I get a reference to an instianted object from another one?

For example if I have two different objects lets say a menu jMenuBarX and a frame jFrameX. How can I get a reference to jFrameX from jMenuBarX so I can access all public the methods on the frame? It would be nicer if I could get a refrence to it and test to see if it has acctually been instianted first.

Thanks in advance

Jeff Sulman
 
Do you mean getting a reference to the frame that contains the menubar? Wouldn't the frame have to be instantiated before you could add the menubar to it? If thats the case you could simply pass a reference from the frame to the menubar early on after you instantiate the menubar and then just hold that reference in the menubar until you need it later. Thats operating under the assumption that your extending the menubar.

Have you considered the getOwner method inherited from the Window class?

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top