I am creating a small application using AWT. When I try to close the window, the "close" button doesn't work.

Here's my code:

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import javax.swing.*;

class ButtonDemo1 implements ActionListener {
    Button b1;
    TextField tf;
    Frame f;

    ButtonDemo1(String s) {
        f = new Frame(s);
        b1 = new Button("OK");

        tf = new TextField(10);
        f.setSize(200, 250);
        f.setVisible(true);
        b1.addActionListener(this);

        f.add(tf);
        f.add(b1);

        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent we) {
                System.exit(0);
            }
        });

        f.setLayout(new FlowLayout());
    }

    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == b1) {
            tf.setText("Press Ok");
        }

    }

    public static void main(String args[]) {
        new ButtonDemo1("First");
    }
}

How can I fix the "close" button?

Edit
Report