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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GUI problem panel in a panel

Status
Not open for further replies.

Chrissirhc

Programmer
May 20, 2000
926
GB
My GUI has panels in panels. I have a panel in a panel in a panel in panel. If in the final panel I right click I want to click the right button and a popup menu comes up. When I click on the popup menu 'show dialog' option I want a JDialog to come up, but... I want to add the JDialog to my main frame and I haven't got a refence to the main frame from a panel so deep down. Should I pass refences through all the constructors just to do this. Or is there a better way to do this.

Chris
 
I am replying without the text in front of me, and with no clear understanding myself...

But in Deitel & Deitel's Java2 book, I recall them spawning JDialogs and passing "null" as the 'Parent Frame'. Might this work?

Failing that, or if you definitely want the JDialog to have your main JFrame as the parent, I think if you check out Singletons, you may find the answers. A senior developer at work was overheard (by me) to say "Singletons are awesome.. it's the top level window that can be seen from everywhere!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top