/** * Program: Compare * @author: Paul Garrett, garrett@math.umn.edu * @version: Sun Aug 22 16:56:45 CDT 1999 * * Purpose: Monte-Carlo test for equality * */ //import lib.*; import java.awt.*; public class Compare extends java.applet.Applet { TextField first, second; Button compare; Label theLabel; /* * For the moment, don't worry about definedness... */ public void init() { first = new TextField(50); second = new TextField(50); compare = new Button("compare"); add(first); add(second); add(compare); theLabel = new Label(""); } public boolean action(Event e, Object ob) { if (e.target == compare) { boolean queryEqual = Tree.probEquals( first.getText(), second.getText(), 0, 1, .000000001); if (queryEqual == true) { remove(theLabel); theLabel = new Label(" they are equal "); add(theLabel); this.validate(); //__EDIT__ } else { remove(theLabel); theLabel = new Label(" not equal "); add(theLabel); this.validate(); //__EDIT__ } return true; } return false; } } /************************************************** * * The End * ***************************************************/