不知道,看不出错在哪了
(不过,建议你用swing设计界面,比awt好)

解决方案 »

  1.   

    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);
          btn.addActionListener(this);//注册事件。
          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);
             label.setText("你好");
            setLayout(null);
            label.setBounds(100,60,40,30);//设置LABEL的显示位置。
             add(label);
             addWindowListener(new WindowAdapter()
              {
                public void windowClosing(WindowEvent e)
                {
                   System.exit(0);
                }
              }); 
              
          }
       }
    }
      

  2.   

    大胃不错哦,,他应该是没有在编译器运行的,我有要。
    btn.addActionListener(this);//注册事件。
    label.setBounds(100,60,40,30);//设置LABEL的显示位置。