Thread View: aus.computers.java
2 messages
2 total messages
Started by DP
Fri, 17 Aug 2001 07:48
How to notify parent frame?
Author: DP
Date: Fri, 17 Aug 2001 07:48
Date: Fri, 17 Aug 2001 07:48
24 lines
2424 bytes
2424 bytes
hi, I've got a problem like this. I have a 'Main' JFrame, which has buttons. I click on 'show Options' button, another 'Options' JFrame appears. After I have selected all options in 'Options' JFrame, I then click 'Ok' button or 'Cancel' button. The 'Main' JFrame needs to know whether I have clicked 'Ok' or 'Cancel' button, ie. it has to wait until I dispose 'Options' JFrame. I have 2 options to solve this problem: 1. In 'Main' JFrame, I will have a public function which 'Options' JFrame will call when I click 'Ok' or 'Cancel' button. In this case, I have to pass 'this' pointer from 'Main' to 'Options' JFrame. The program will create a circle, ie. in 'Main' I have one instance of 'Options' and vice versa. 2. I'll create a thread in 'Main', and continuously check for existence of 'Options'. This will consume a lot of resources. Can anyone suggest a better solution? Thank you very much for your help. Cheers, Dang.
Re: How to notify parent frame?
Author: Paul Murray
Date: Wed, 29 Aug 2001 00:15
Date: Wed, 29 Aug 2001 00:15
25 lines
2569 bytes
2569 bytes
"DP" <Dang@csse.monash.edu.au> wrote in message news:9lii69$lpl$1@towncrier.cc.monash.edu.au... > hi, > > I've got a problem like this. > > I have a 'Main' JFrame, which has buttons. I click on 'show Options' button, > another 'Options' JFrame appears. After I have selected all options in > 'Options' JFrame, I then click 'Ok' button or 'Cancel' button. The 'Main' > JFrame needs to know whether I have clicked 'Ok' or 'Cancel' button, ie. it > has to wait until I dispose 'Options' JFrame. 1 - Pass the options frame (in the constructor or in a method) a callback object. 2 - Have the parent frame listen to WindowEvents on the child frame. __________________________________________________ Jer 48:10 A curse on him who is lax in doing the Lord's work! A curse on him who keeps his sword from bloodshed! Mk 16:16 He that believeth and is baptized shall be saved; but he that believeth not shall be damned. The real message of christianity is, and always has been, "Be a christian!".
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads