Dialog(Dialog owner) 
          Constructs an initially invisible, non-modal Dialog with an empty title and the specified owner dialog. 
Dialog(Dialog owner, String title) 
          Constructs an initially invisible, non-modal Dialog with the specified owner dialog and title. 
Dialog(Dialog owner, String title, boolean modal) 
          Constructs an initially invisible Dialog with the specified owner dialog, title, and modality. 
Dialog(Frame owner) 
          Constructs an initially invisible, non-modal Dialog with an empty title and the specified owner frame. 
Dialog(Frame owner, boolean modal) 
          Constructs an initially invisible Dialog with an empty title, the specified owner frame and modality. 
Dialog(Frame owner, String title) 
          Constructs an initially invisible, non-modal Dialog with the specified owner frame and title. 
Dialog(Frame owner, String title, boolean modal) 
          Constructs an initially invisible Dialog with the specified owner frame, title, and modality. 

解决方案 »

  1.   

    和Dialog的构造函数有关,一共有七个:
    Dialog(Dialog owner)
    Dialog(Dialog owner,String title)
    Dialog(Dialog Owner,String title,boolean modal)
    Dialog(Frame owner)
    Dialog(Frame owner,boolean modal)
    Dialog(Frame owner,String title)
    Dialog(Frame owner,String title,boolean modal)
    看看,一可以用哪一个?
      

  2.   

    你的 this 不是 applet 就是 button
    当然不行。
    用 null 试试。
      

  3.   

    看看JOptionPane这个类吧,重点看showMessageDialog方法,应该能够解决你的问题了。顺便问一下,你以前使用C++得的吧。记住给分哦。showMessageDialog 
    Displays a modal dialog with one button, which is labeled "OK" (or the localized equivalent). You can easily specify the message, icon, and title that the dialog displays. Here are some examples of using showMessageDialog: 
     //default title and icon
    JOptionPane.showMessageDialog(frame,
        "Eggs aren't supposed to be green."); 
     //custom title, warning icon
    JOptionPane.showMessageDialog(frame,
        "Eggs aren't supposed to be green.",
        "Inane warning",
        JOptionPane.WARNING_MESSAGE); 
     //custom title, error icon
    JOptionPane.showMessageDialog(frame,
        "Eggs aren't supposed to be green.",
        "Inane error",
        JOptionPane.ERROR_MESSAGE); 
     //custom title, no icon
    JOptionPane.showMessageDialog(frame,
        "Eggs aren't supposed to be green.",
        "A plain message",
        JOptionPane.PLAIN_MESSAGE); 
     //custom title, custom icon
    JOptionPane.showMessageDialog(frame,
        "Eggs aren't supposed to be green.",
        "Inane custom dialog",
        JOptionPane.INFORMATION_MESSAGE,
        icon);