主题:一个实现对话框弹出的问题
import java.awt.event.*;
import javax.swing.*;
public class P0705
{
public static void main (String[] args)
{
CloseFrame frame=new CloseFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
JOptionPane.showMessageDialog(null,output,"close",JOptionPane.CLOSED_OPTION);
System.exit(0);
}
});
frame.show();
}
}
class CloseFrame extends JFrame implements ActionListener
{
public CloseFrame()
{
setTitle("弹出窗口");
setSize(300,300);
}
}
题目要求关闭窗口弹出对话框,提示是否确定关闭。
我写的程序有错误,能帮我改改吗??
import javax.swing.*;
public class P0705
{
public static void main (String[] args)
{
CloseFrame frame=new CloseFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
JOptionPane.showMessageDialog(null,output,"close",JOptionPane.CLOSED_OPTION);
System.exit(0);
}
});
frame.show();
}
}
class CloseFrame extends JFrame implements ActionListener
{
public CloseFrame()
{
setTitle("弹出窗口");
setSize(300,300);
}
}
题目要求关闭窗口弹出对话框,提示是否确定关闭。
我写的程序有错误,能帮我改改吗??