aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JFrame / JDialog communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame / JDialog communication" Watch "JFrame / JDialog communication" New topic

JFrame / JDialog communication

Rick Crawford
Ranch Hand

Joined: Aug 17, 2001
Posts: 34
I have a situation very similar to the one described in this link:
What I'm wanting to do is reference a member variable within the class that started up the instance of the dialog. In other words, once the dialog (a descendant of JDialog) is started, I want him to be able to 'see' a variable within the parent JFrame.
I'm very new to Swing. Is there some sort of getParentObjectThatStartedMeUp method that I could use to refer back to the JFrame?
Thanks for any help,
Rick Crawford
[This message has been edited by Rick Crawford (edited September 24, 2001).]
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
If you passed the parent frame into the JDialog constructor, you already have the reference. Just save it.
API JDialog(Frame owner, boolean modal) or JDialog(Frame owner)
Rick Crawford
Ranch Hand

Joined: Aug 17, 2001
Posts: 34
That did it! You 'da man!
Thanks for the help,
Rick Crawford
Don't get me started about those stupid light bulbs.
subject: JFrame / JDialog communication
Similar Threads
JFrame or customed JDialog or ?
How to limit text in AWT Text field ?
image button in awt
DialogBox is gone after setModal
Opening a browser from a Java app