question: public static WaitDialog showDialog ( WaitDialog . Runnable runnable , String message , Container container , int width , int height ) { WaitDialog newDialog = null ; if ( container instanceof JDialog ) { newDialog = new WaitDialog ( ( JDialog ) container ) ; } else if ( container instanceof JFrame ) { newDialog = new WaitDialog ( ( JFrame ) container ) ; } else { newDialog = new WaitDialog ( ( JDialog ) null ) ; newDialog . setLocationRelativeTo ( container ) ; } newDialog . buildDialog ( width , height ) ; runnable . setDialog ( newDialog ) ; newDialog . container = container ; newDialog . runnable = runnable ; newDialog . setMessage ( message ) ; Thread processThread = new ProcessThread ( newDialog ) ; processThread . start ( ) ; while ( ! newDialog . isVisible ( ) ) { try { Thread . sleep ( 100 ) ; } catch ( InterruptedException ie ) { } } return newDialog ; }
target:  Will display message in a modal JDialog while in the run method of runnable. Will set the location of the JDialog relative to container