关于对话框的问题
import java.awt.*;
import java.awt.event.*;
public class WWWW extends Frame implements ActionListener
{
Button btn=new Button("提示");
Panel p=new Panel();
WWWW()
{
super("Windows");
setSize(350,200);
setVisible(true);
add(p);
p.add(btn);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
show();
}
public static void main(String[] args)
{
new WWWW();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==btn)
{
MyDialog dlg=new MyDialog(this,true);
dlg.show();
}
}
class MyDialog extends Dialog
{
Label label=new Label();
MyDialog(WWWW parent,boolean modal)
{
super(parent,modal);
setSize(260,140);
setResizable(false);
setLayout(null);
add(label);
addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
label.setText("你好");
}
}
}
为什么对话框出不来呢