Thread.sleep(1000);
Thread.sleep(2000);
  private void startAutoMode() {    new Thread(new Runnable() {        public void run() {          while (true) {            try {              SwingUtilities.invokeAndWait(new Runnable() {                  public void run() {                    curFrame = addWindow(false);                  }                });            } catch (Exception e) {              e.printStackTrace();            }            try {              Thread.sleep(1000);            } catch (InterruptedException e) {            }            try {              SwingUtilities.invokeAndWait(new Runnable() {                  public void run() {                    curFrame.doDefaultCloseAction();                  }                });            } catch (Exception e) {              e.printStackTrace();            }            try {              Thread.sleep(1000);            } catch (InterruptedException e) {            }          }        }      }).start();  }