question: public static String showDialog ( final Frame frame , final String title , final Object message , final int messageType , final String ... buttons ) { final Object [ ] options = new Object [ buttons . length ] ; for ( int i = 0 , buttonsLength = buttons . length ; i < buttonsLength ; i ++ ) { options [ i ] = buttons [ i ] ; } final JOptionPane pane = new JOptionPane ( message , messageType ) ; pane . setOptions ( options ) ; final JDialog window = pane . createDialog ( frame , title ) ; window . setVisible ( true ) ; return ( String ) pane . getValue ( ) ; }
target:  Show a new modal dialog and block until the user press a button of closes the dialog