import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class JText_test2 extends JFrame implements ActionListener {
    JTextField inputtext = new JTextField();
    JTextField resulttext = new JTextField();
    public JText_test2() {
        try {
            jbInit();
        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }
    private void jbInit() throws Exception {
        getContentPane().setLayout(null);
        inputtext.setText("Ӣ");
        inputtext.setBounds(new Rectangle(22, 32, 132, 30));
//JText_test2ʵΪinputtextļ
        inputtext.addActionListener(this);
        this.setTitle("¼");
        this.getContentPane().add(resulttext);
        this.getContentPane().add(inputtext);
        resulttext.setText("");
        resulttext.setBounds(new Rectangle(23, 91, 134, 29));
    }
    public static void main(String args[]) {
        JText_test2 tx = new JText_test2();
        tx.setBounds(200, 200, 200, 200);
        tx.validate();
        tx.setVisible(true);
}
//¼
    public void actionPerformed(ActionEvent e) {
        String word = inputtext.getText();
        if (word.equals("boy")) {
            resulttext.setText("к");
        } else if (word.equals("girl")) {
            resulttext.setText("Ů");
        } else if (word.equals("sun")) {
            resulttext.setText("̫");
        } else {
            resulttext.setText("ûиõ");
        }
     }
}
