Your code is basically correct -- has a few language problems,
though, and a few things left out. Here's a corrected version which
works perfectly.

----------------------------------------------------------------------
( import java.awt.* )
( import jess.* )

( deffunction  testText ( ?string )

  (bind ?ta   ( new TextArea 20 80 ))
  (bind ?taw  ( new TextAreaWriter ?ta ))

  (bind ?f (new Frame)) ;; For your TextArea to show up
  (call ?f add ?ta)     ;; you have to stick it in a window!
  (call ?f pack)
  (set ?f visible TRUE)

  (bind ?re   (engine))

  ;; You forgot the question markl before each occurrence of
  ;; "taw" below.        
  ( call ?re  addOutputRouter  "t"  ?taw )
  ( call ?re  addOutputRouter  "WSTDOUT"  ?taw )
  ( call ?re  addOutputRouter  "WSTDERR"  ?taw )

  (printout t "Deffunction  testText  entered with " ?string  crlf )

)

;; You have to call the function, of course
(testText    123)
----------------------------------------------------------------------

I think Katz, Ed wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Not sure my previous message was sent, so I'm re-sending it.
> 
> Using java example in 4.4.7, I'm trying to redirect the
> "t" router to use the TextAreaWriter from JESS, but JESS
> doesn't like it.  How can I use a TextAreaWriter as the
> "t" router from JESS?
> 
> ( import  java.awt.TextArea )
> ( import  jess.awt.* )
> ( import  jess.* )
> 
> ( deffunction  testText ( ?string )
> 
>   (bind ?ta   ( new TextArea 20 80 ))
>   (bind ?taw  ( new TextAreaWriter ?ta ))
>   (bind ?re   (engine))
> 
>   ( call ?re  addOutputRouter  "t"  taw )
>   ( call ?re  addOutputRouter  "WSTDOUT"  taw )
>   ( call ?re  addOutputRouter  "WSTDERR"  taw )
> 
>   (printout t "Deffunction  testText  entered with " ?string  crlf )
> 
> )
> 



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