Hello Friends

I'm writing a wrapper class MyWrapper for dialog.I have TextFiled , OK Button and Cancel Button on MyDialog. the wrapper class returns Textfield value by function getTextfieldValue().and wrapper class also has a function showDialog() function.

I'm Using this wrapper class in another Pprogram i.e Myanother() extends Frame. This has a button1 on this. If I press button1:
1)I'm Creating a Wrapper class.
MyWrapper wrap = new MyWraper();
2) then, I'm calling s
wrap.showDialog();
now i'll get MYDialog on the screen.
3) here i entered "APPLE" in text field.
4) To get Text field value ,
I can use Wrapper class function
String str = wrap.getTextFieldValue();
But I want to get this value , if user presses OK button on My Dialog.
But, How Myanother Program (i.e External Program ) Knows User pressed OK Button. If User Presses OK Button on My Dialog, Then Only I have to use the Function getTextFieldValue().

Q1)But How External program knows that User pressed OK Button.

Q2)If i write a bean to this wrapper, how to raise event and inform to external program that, user has pressed OK Button??

Please clarify my doubt...

Regards
sat