private static void createToolsFrame ( ) { // put UI in a JFrame frame = new JFrame ( "NetCDF (" + DIALOG_VERSION + ") Tools" ) ; ui = new ToolsUI ( prefs , frame ) ; frame . setIconImage ( BAMutil . getImage ( "netcdfUI" ) ) ; frame . addWindowListener ( new WindowAdapter ( ) { @ Override public void windowActivated ( final WindowEvent e ) { ToolsSplashScreen . getSharedInstance ( ) . setVisible ( false ) ; } @ Override public void windowClosing ( final WindowEvent e ) { if ( ! done ) { exit ( ) ; } } } ) ; frame . getContentPane ( ) . add ( ui ) ; final Rectangle have = frame . getGraphicsConfiguration ( ) . getBounds ( ) ; final Rectangle def = new Rectangle ( 50 , 50 , 800 , 800 ) ; Rectangle want = ( Rectangle ) prefs . getBean ( FRAME_SIZE , def ) ; if ( want . getX ( ) > have . getWidth ( ) - 25 ) { // may be off screen when switcing between 2 monitor system want = def ; } frame . setBounds ( want ) ; frame . pack ( ) ; frame . setBounds ( want ) ; // in case a dataset was on the command line if ( wantDataset != null ) { setDataset ( ) ; } }
Must call this method on the event thread .