Hi,

I am fairly new to the whole gui/event-driven model of programming and am 
hoping that someone can offer me some advice.

I've written a class in java that when called , displays a 'pop-up' window 
with a number of buttons on it.  When a user hits a button, a value is 
returned.

I've integrated this into Jess in the following way:

(bind ?x (new popupwindow))
(bind ?y (call ?x get-return-value))

Where 'get-return-value' is the method within the class 'popupwindow' that 
waits for the user to click on a button.

When I first implemented this, the 2nd line of the above code would fire off 
the method that displays the window and then immediately continue with the 
next jess program statement.

I understand why it does this, but what I want to happen is that the jess 
program execution is halted until a user has pressed a button on the pop up 
window.

The only way I have managed to do this is to put a holding loop in the  java 
method which waits until a user has clicked a button.  The code for this 
loop is as follows:

while (retval==0)
{
  try {
       Thread.sleep(1500);
  }
  catch (InterruptedException e)
  {
    return 0;
  }
}

return retval;

Within the ActionListener portion of the button code, if a user hits a 
button the variable retval is modified to an integer value.

Anyway, my question is, is there a more elegant way of doing this?  It seems 
to me to be a bit of kludge, but I am unsure of what else I can do.  Any 
help would be really appreciated.

thanks

Neil
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to