Thread View: aus.computers.java
2 messages
2 total messages
Started by Dang Phan
Fri, 17 Aug 2001 07:58
How to notify parent frame?
Author: Dang Phan
Date: Fri, 17 Aug 2001 07:58
Date: Fri, 17 Aug 2001 07:58
24 lines
2371 bytes
2371 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: Charles May
Date: Fri, 17 Aug 2001 13:20
Date: Fri, 17 Aug 2001 13:20
30 lines
2622 bytes
2622 bytes
It would be simpler to have your main application gui be the "parent" JFrame and the Options gui be a modal JDialog instead of another JFrame. "Dang Phan" <dangphan@mosca.csse.monash.edu.au> wrote in message news:<9liio0$mov$2@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. > > 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.
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