这样做好像不行,把延时放在Dialog的线程之外,然后再时间到了之后通知Dialog的线程区关闭对话框

解决方案 »

  1.   

    public WaitingDialog() {
            super(MapView.parentFrame);
            setTitle("waiting...");
            pack();
            setModal(true);
            setResizable(false);  
            
            initPanel();
        }
    下面的那个PACK();去掉试试。
      

  2.   

    splash myLogo = new splash(); //for creting an object
    myLogo.setVisible(true); //show the logo
    frame = new frameApp(); //for running the progam
    myLogo.setVisible(false); //hide the logo
    myLogo = null; // no longer use it/////////////
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Toolkit;import javax.swing.BorderFactory;
    import javax.swing.ImageIcon;
    import javax.swing.JPanel;
    import javax.swing.JWindow;public class splash extends JWindow
    {
    splash()
    {
    JPanel panel = new JPanel()
    {
    //for painting the component
    public void paintComponent(Graphics g)
    {
    //for getting the image
    ImageIcon img = new ImageIcon(ClassLoader.getSystemResource ("frameApp/images/Logo.JPG"));
    //for drawing the image
    g.drawImage(img.getImage(), 0, 0, null);
    super.paintComponent(g);
    }
    };

    //for setting the border
    panel.setOpaque(false);
    //for setting the panel in the contentPane
    panel.setBorder(BorderFactory.createEtchedBorder());
    panel.setBackground(Color.BLUE);
    //for setting the ContentPane to true
    setContentPane(panel);

    setSize(350, 250);
    Dimension frameSize = getSize();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
    setVisible(true);
    }
    }
      

  3.   

    cuizm(射天狼) 兄为何我显示出的只是一片空白
      

  4.   

    Runnable接口的用法不太对
    public class WaitingDialog extends JDialog implements Runnable {
    ...
    private Thread waitThread = null;
    public start() {
      if (waitThread == null) {
         waitThread = new Thread(this, "waitdialog");
         waitThread.start();
      }
    }public void run() {
    ...
    }
    ...
    }