netbeans - Jess printout contents print in Java -
i trying printout contents jess rhs of rule. similar question described here: output of jess in java there not concrete solution how use router printout command. instead of printing rule's printout contents in java console want print them in dedicated jtextarea. declared string e.g. string result;
hold contents , print out string contents jtextarea through outputtxt.settext(result);
the jess manual discusses case, explicitly; see http://www.jessrules.com/jess/docs/71/library.html#routers , http://www.jessrules.com/jess/docs/71/library.html#reader . couldn't easier:
// create text area; you'll need add gui, of course textarea ta = new textarea(20, 80); // sort of adapter lets jess print textarea. // there's jtextareawriter swing guis textareawriter taw = new textareawriter(ta); // create rule engine instance rete engine = new rete(); // connect "t" router textarea. point on, // jess code executes "(printout t ..." send output // textarea engine.addoutputrouter("t", taw);
Comments
Post a Comment