Occasional InterruptedException when quitting a Swing application

前端 未结 17 1175
心在旅途
心在旅途 2020-12-05 04:55

I recently updated my computer to a more powerful one, with a quad-core hyperthreading processor (i7), thus plenty of real concurrency available. Now I\'m occasionally

17条回答
  •  孤城傲影
    2020-12-05 05:35

    I was getting a similar error and somehow this worked for me:

    private static void createAndShowGUI() {
      JFrame jf = new MyProgram();
      jf.setVisible(true);
    }
    
    public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
    
            public void run() {
              createAndShowGUI();
            }
        });
    }
    

提交回复
热议问题