Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 在jframe运行时运行线程_Java_Multithreading_Jframe - Fatal编程技术网

Java 在jframe运行时运行线程

Java 在jframe运行时运行线程,java,multithreading,jframe,Java,Multithreading,Jframe,我试图在主框架运行时在后台运行一些代码。但当ı在代码下面运行时,jframe正在打开,但在线程完成之前无法执行任何操作。我的主要方法是: public static void main(String[] args) { Thread thread = new Thread() { @Override public void run() { CheckLicense license = new CheckLicense();

我试图在主框架运行时在后台运行一些代码。但当ı在代码下面运行时,jframe正在打开,但在线程完成之前无法执行任何操作。我的主要方法是:

public static void main(String[] args) {

    Thread thread = new Thread() {

        @Override
        public void run() {
            CheckLicense license = new CheckLicense();
            boolean check = license.checkUpdateStatus();
            if (!check) {
                HMessageBoxForLicenseControl control = new HMessageBoxForLicenseControl(null, null,
                        ModalityType.APPLICATION_MODAL,
                        TextResources.getInstance().getResourceValue("systemNotification"),
                        TextResources.getInstance().getResourceValue("licenseTimeOver"));
                control.setVisible(true);

            }
        }
    };
    thread.start();
    // System.setProperty("file.encoding", "UTF-8");

    MainFrame window = new MainFrame();
    window.frame.setVisible(true);

}