问题
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