Here you can find the source of waitFor(JFrame popup)
public static void waitFor(JFrame popup)
//package com.java2s; //License from project: Apache License import javax.swing.JFrame; public class Main { public static void waitFor(JFrame popup) { while (popup.isVisible()) { try { Thread.sleep(100); } catch (Exception ex) { ex.printStackTrace();/*w w w. ja v a2 s .co m*/ } } } public static void sleep(int ms) { try { Thread.sleep(ms); } catch (Exception ignored) { ignored.printStackTrace(); } } }