Java - Pause initComponents from running?

。_饼干妹妹 提交于 2019-12-24 03:34:32

问题


I am building a JApplet in NetBeans. When the application is initially ran it needs to download some files onto local PC first for it to properly work. Once it is done downloading these files than the GUI should be drawn. How do I pause the JApplet from drawing the GUI until the files are downloaded? Please also note I will need to show the user another GUI that indicates that files are being downloaded, what is the best way of solving this problem? Thank you.

@Override
public void init() {

//THIS IS WHERE THE CODE FOR DOWNLOADING FILES SHOULD BE AND ITS GUI



    /* Create and display the applet */
    try {
        java.awt.EventQueue.invokeAndWait(new Runnable() {

            @Override
            public void run() {
                initComponents();//Draws the main GUI after files have been downloaded
            }
        });

    } catch (Exception ex) {}
}

回答1:


Sounds like you need a Splash Screen.



来源:https://stackoverflow.com/questions/8343949/java-pause-initcomponents-from-running

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!