Dear ejfried,
The code in the frame is like this:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import jess.*;
import jess.awt.TextAreaWriter;
import java.awt.TextArea;
public class Frame1 extends JFrame {
private JPanel contentPane;
private BorderLayout borderLayout1 = new BorderLayout();
private TextArea textArea1 = new TextArea();
private TextAreaWriter txtOutputWriter = new TextAreaWriter(textArea1);
//Construct the frame
public Frame1() {
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
//Component initialization
private void jbInit() throws Exception {
//setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]")));
contentPane = (JPanel) this.getContentPane();
contentPane.setLayout(borderLayout1);
this.setSize(new Dimension(400, 300));
this.setTitle("Frame Title");
Rete r=new Rete(txtOutputWriter);
r.addOutputRouter("t", txtOutputWriter);
r.addOutputRouter("WSTDOUT", txtOutputWriter);
r.addOutputRouter("WSTDERR", txtOutputWriter);
//r.executeCommand("(printout t \"Hello, world! crlf\")");Having no problem with this
one.
//No problem compiling it. Having
problems running this one. The application will just run forever and won't
display anything in the textArea. And I can't see any error
message.
try
{
Value v=r.executeCommand("(batch animal.clp)");
}
catch(JessException je){System.out.print("wrong in animal.clp");}
{
Value v=r.executeCommand("(batch animal.clp)");
}
catch(JessException je){System.out.print("wrong in animal.clp");}
//r.executeCommand("(batch zebra.clp)");Having no problem with this
one.
r.executeCommand("printout t \"hello\" crlf");
contentPane.add(textArea1, BorderLayout.CENTER);
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
}
======= You wrote on 2003-10-16 :=======
>> I think Yingying Chen wrote:
>> >
Hi all, I am a new JESS user. I am trying to test input/output routers in my java application. I have no trouble to execute batch cammand of zebra.clp,
wordgame.clp, ect. and direct their output to the TextAreaWriter except animal.clp. I've set the correct classpath and I can execute batch command of
animal.clp in the command prompt. Is there something special with animal.clp? Is that because it need to write the animal.dat file back out?
>> >
>>
>>
Well, you don't tell us what goes wrong running the "Animals" example,
>>
but I suspect whatever the problem is, it's related to the fact that,
>>
of all the examples you've listed, only "Animals" both writes output
>>
to and reads input from the console
>>
>>
Without more details on specifically what you've done and what's going
>>
wrong, I don't think we can help you.
>>
>> ---------------------------------------------------------
>> Ernest Friedman-Hill
>>
Distributed Systems Research Phone: (925) 294-2154
>>
Sandia National Labs FAX: (925) 294-2234
>>
PO Box 969, MS 9012 [EMAIL PROTECTED]
>>
Livermore, CA 94550 http://herzberg.ca.sandia.gov
>>
>>
--------------------------------------------------------------------
>>
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]
>>
--------------------------------------------------------------------
= = = = = = = = = = = = = = = = = = = =
Yingying Chen
2003-10-16
