This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
subject: JFrame / JDialog communication
Similar Threads
DialogBox is gone after setModal
How to limit text in AWT Text field ?
Opening a browser from a Java app
JFrame or customed JDialog or ?
image button in awt