public static void main ( String args [ ] ) { boolean usePopup = false ; for ( int i = 0 ; i < args . length ; i ++ ) { if ( args [ i ] . equals ( "-usePopup" ) ) usePopup = true ; } try { store = XMLStore . createFromFile ( "ThreddsDatasetChooser" , null ) ; p = store . getPreferences ( ) ; } catch ( IOException e ) { System . out . println ( "XMLStore Creation failed " + e ) ; } // put it together in a JFrame final JFrame frame = new JFrame ( "Thredds Dataset Chooser" ) ; frame . addWindowListener ( new WindowAdapter ( ) { public void windowClosing ( WindowEvent e ) { chooser . save ( ) ; Rectangle bounds = frame . getBounds ( ) ; p . putBeanObject ( FRAME_SIZE , bounds ) ; try { store . save ( ) ; } catch ( IOException ioe ) { ioe . printStackTrace ( ) ; } System . exit ( 0 ) ; } } ) ; chooser = new ThreddsDatasetChooser ( p , null , frame , true , usePopup , false ) ; chooser . setDoResolve ( true ) ; // frame . getContentPane ( ) . add ( chooser ) ; Rectangle bounds = ( Rectangle ) p . getBean ( FRAME_SIZE , new Rectangle ( 50 , 50 , 800 , 450 ) ) ; frame . setBounds ( bounds ) ; frame . pack ( ) ; frame . setBounds ( bounds ) ; frame . setVisible ( true ) ; }
Standalone application .