Clearing contents of TextField using setText does not work in AWT
I am having problems clearing contents of TextField in AWT using setText() method. Apparently, setText("") does not clear the contents of the TextField on pressing the 'Reset' button. Here's my program: import java.awt.*; import java.awt.event.*; public class form extends Frame { Label lbl = new Label("Name:"); TextField tf = new TextField(); Button btn = new Button("Reset"); public form() { tf.setColumns(20); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); btn.addActionListener(new ActionListener() { public void actionPerformed