Hello
This is my problem:
I have a rule: (defrule Rule1 => (printout t "Enter a number") (readline t))
I want "Enter a number" is printed in a TextArea and input a number in a
TextField. I set the TextArea is the output router and TextField is the input
router. When I run my program, "Enter a number" was displayed in the TextArea
but my program was locked. I couldn't input anything into the TextField.
Please help me.
I'm so sorry for my English.
Thanks a lot!
Here is apart of my program.
public class frmExample1 extends javax.swing.JFrame
{
Rete engine;
TextReader tr;
TextAreaWriter taw;
public frmExample1()
{
initComponents();
engine=new Rete();
taw=new TextAreaWriter(taQuestion);
//taQuestion is a TextArea
engine.addOutputRouter("t", taw);
engine.addOutputRouter("WSTDOUT", taw);
engine.addOutputRouter("WSTDERR", taw);
tr=new TextReader(false);
engine.addInputRouter("t", tr, true);
engine.addInputRouter("WSTDIN", tr, true);
try
{
engine.eval("(defrule Rule1 => (printout t 'Enter a
number')(readline t))");
}catch(Exception e){System.out.println(e.toString());}
engine.reset();
engine.run();
}
private void txtAnswerActionPerformed(java.awt.event.ActionEvent evt)
{
tr.appendText(txtAnswer.getText() + "\n");
txtAnswer.setText("");
//txtAnswer is a TextField
}
}
Cảm giác an toàn hơn khi online. Nâng cấp lên Internet Explorer 8 mới, an
toàn hơn,tối ưu hóa cho Yahoo!. Hoàn toàn miễn phí. Tải IE8 tại đây!
http://downloads.yahoo.com/vn/internetexplorer/