dcsimg
How do you make JFrames communicate ?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   PA_Autosend
Posted On:   Tuesday, April 9, 2002 07:29 AM

I'm writing an application which has a main window and a configuration one, I use JFrames for both. How can I do to have the result of the configuration window in the main one ? I experimented several solutions but i dont find them very good : 1 - a button from the main window launches the configuration thanks to a listener. The class configframe has a boolean (finished) and a string (result) as fields. configframe = new configframeUI(); while (!configframe.finished) {sleep for 1 seconde} 2- same fields for the configuration but configframe = new configframeUI(); String result = configframe.getResult(); where getresult() is while (   More>>

I'm writing an application which has a main window and a configuration one, I use JFrames for both.
How can I do to have the result of the configuration window in the main one ?


I experimented several solutions but i dont find them very good :


1 -
a button from the main window launches the configuration thanks to a listener. The class configframe has a boolean (finished) and a string (result) as fields.
configframe = new configframeUI();
while (!configframe.finished) {sleep for 1 seconde}


2-
same fields for the configuration but
configframe = new configframeUI();
String result = configframe.getResult();


where getresult() is
while (!OK) {do nothing or sleep 1 seconde}
return result;



I noticed that there can be some refresh UI issues with these methods.
Can you tell me what to do innstead ? (threads, listeners...)


Any help greatly appreciated.

   <<Less
About | Sitemap | Contact