I think Charles Lee wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Would appreciate if anyone give me a pointer.
> 
> How do I use my own GUI to display the Tank in the pumps example( I know how
> to write my GUI, but don't know how to get the tank level)?
> I would like to write my own GUI instead of using the Jess GUI to display
> the Tank in the pumps example. But I don't know where to interface with
> Jess.
> 
> Thank you,
> Charles
> 

Well, as is often the case, there's more than one way to do it. One
way isn't Jess-specific, per se: just register your GUI class as a
PropertyChangeListener with the Tank object, and you'll get
PropertyChangeEvents when the level changes. You can do this
registration using Jess if you like -- i.e., 

        (bind ?tank (new Tank "MAIN"))
        (?tank addPropertyChangeListener (new MyGUIClass))

Another way is to use a Jess rule to send notification to your GUI
object when the level changes. Say in your main routine, you create an
instance of MyGUIClass and store it in the Rete object under the name
"GUI". Then the rule might look like

(defrule update-GUI
  (Tank (level ?level) (OBJECT ?tank))
  =>
  ((fetch GUI) updateLevelDisplay ?tank ?level))

where updateLevelDisplay is a method you've written to receive these
notifications. 




---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

--------------------------------------------------------------------
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