/* A basic extension of the java.applet.Applet class */ import java.awt.*; import java.applet.*; public class Applet1 extends Applet { public void init() { // Take out this line if you don't use symantec.itools.net.RelativeURL or symantec.itools.awt.util.StatusScroller symantec.itools.lang.Context.setApplet(this); // This code is automatically generated by Visual Cafe when you add // components to the visual environment. It instantiates and initializes // the components. To modify the code, only use code syntax that matches // what Visual Cafe can generate, or Visual Cafe may be unable to back // parse your Java file into its visual environment. //{{INIT_CONTROLS setLayout(null); setSize(424,381); button1.setLabel("check"); add(button1); button1.setBackground(java.awt.Color.lightGray); button1.setBounds(264,24,79,32); add(textField1); textField1.setBounds(96,48,132,32); add(textField2); textField2.setBounds(96,96,129,35); add(textField3); textField3.setBounds(96,156,141,41); label1.setText("word1"); add(label1); label1.setBounds(36,36,57,39); label2.setText("word2"); add(label2); label2.setBounds(36,96,56,33); label3.setText("answer"); add(label3); label3.setBounds(24,156,60,38); label4.setText("Anagram Checker"); add(label4); label4.setFont(new Font("Dialog", Font.PLAIN, 16)); label4.setBounds(48,12,184,29); //}} //{{REGISTER_LISTENERS SymAction lSymAction = new SymAction(); button1.addActionListener(lSymAction); //}} } //{{DECLARE_CONTROLS java.awt.Button button1 = new java.awt.Button(); java.awt.TextField textField1 = new java.awt.TextField(); java.awt.TextField textField2 = new java.awt.TextField(); java.awt.TextField textField3 = new java.awt.TextField(); java.awt.Label label1 = new java.awt.Label(); java.awt.Label label2 = new java.awt.Label(); java.awt.Label label3 = new java.awt.Label(); java.awt.Label label4 = new java.awt.Label(); //}} class SymAction implements java.awt.event.ActionListener { public void actionPerformed(java.awt.event.ActionEvent event) { Object object = event.getSource(); if (object == button1) button1_ActionPerformed(event); } } void button1_ActionPerformed(java.awt.event.ActionEvent event) { String word1 = textField1.getText(); String word2 = textField2.getText(); Anagram ana = new Anagram(); if (ana.check(word1,word2)) textField3.setText("yes"); else textField3.setText("no"); } }