How to get Frame of your app?
I want to create a JDialog, and I'd like to construct
it with a Frame object passed in so it floats on top
of my app instead of somewhere else.
How the heck to I get a reference to my main JFrame ?
I have a JFrame, then a JPanel, then some buttons.
One of the buttons will call the JDialog but I have
no idea how to get a hold of it.
Please help.
There must be a simple statement I can use to get the
main JFrame.
Thanks
Josh
[506 byte] By [
jgunder] at [2007-9-27 1:02:04]

I haven't created the dialog yet.
I need a reference to my JFrame before
I can do that. Frame object is part
of the JDialog constructor.
First I need to get the frame object
Then I can create the dialog.
How can I get a reference to my JFrame.
Still need help.
Ok.
I think you have a JFrame and
a JPanel added to JFrame,
And this JPanel contains JButton, Am I right?
Then
Container parent = button.getParent(); //this will be theJPanel
Container grandParent = parent.getParent(); //this will be your JFrame
BR