wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Parent/Child Window 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 » Beginning Java
Bookmark "Parent/Child Window Communication" Watch "Parent/Child Window Communication" New topic
Author

Parent/Child Window Communication

Lang Miao
Greenhorn

Joined: Oct 22, 2004
Posts: 12
Background: I have a parent window (JFrame object) CustomerForm and a child window (JFrame object) InsertForm. InsertForm is displayed when insert button on CustomerForm is clicked.

Question:
1. When InsertForm is displayed, how can I make CustomerForm not accessible? Previously I use setFocusableWindowState( false ) but that only makes CustomerForm stays behind InsertForm; the buttons on CustomerForm are still clickable.

2. How do I pass info on InsertForm to CustomerForm? I have text fields of Name, Address, etc. Do I just use getText() and pass the values to CustomerForm's variable?

Thanks in advance
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
>1. When InsertForm is displayed, how can I make CustomerForm not accessible?

when InsertForm is created, next line = CustomerForm.setVisible(false);
in the constructor of InsertForm, have

2. How do I pass info on InsertForm to CustomerForm?
either make InsertForm an inner class (exposing the variables to InsertForm)
or pass a reference to CustomerForm when InsertForm is created


then, in the window closing event you add the code to update CustomerForm data
Lang Miao
Greenhorn

Joined: Oct 22, 2004
Posts: 12
Regarding your solution #1
The CustomerForm, then, will be hidden. I just want to deactive it. User still sees it but can't bring it on top or press any buttons on it
I come up with this one. Let me know if this sufficient.


Thanks a bunch for the previous reply. Solution #2 works great.
[ October 22, 2004: Message edited by: Lang Miao ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Swing / AWT / SWT / JFace forum...
[ October 23, 2004: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parent/Child Window Communication
 
Similar Threads
How to access parent JFrame component from its Child frame
parent window notification
about the addWindowListener()
Parent/Child Window Communication
parent window notification