File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame / JDialog communication" Watch "JFrame / JDialog communication" New topic
Author

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: http://www.javaranch.com/ubb/Forum2/HTML/001601.html
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
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