当关闭一个窗口时弹出一个确认窗口
请问要怎么做
可以关闭确认窗口时
不把主窗口关闭呢?import java.awt.*;
import java.awt.event.*;class WindowEventHandle1 extends WindowAdapter implements ActionListener
{
public void windowClosing(WindowEvent e)
{
   Frame f2=new Frame("是否关闭");
   f2.setSize(200,100);
   f2.setVisible(true);
   Button b1=new Button("确定");
   b1.addActionListener(this);
       f2.addWindowListener(new WindowEventHandle2());
   f2.add(b1);
} public void actionPerformed(ActionEvent e)
{
   String cmd=e.getActionCommand();
   if(cmd.equals("确定"))
   System.exit(0);
}
}class WindowEventHandle2 extends WindowAdapter
{
    public void windowClosing(WindowEvent e)
{
    System.exit(0);
}
}public class WindowClosing1
{
public static void main(String args[])
{
   Frame f1=new Frame("WindowClosing1");
   f1.addWindowListener(new WindowEventHandle1());
   f1.setSize(400,400);
   f1.setVisible(true);
}
}上面的代码那些地方错了呢
请高手帮忙,多谢!!!