private void readPreferences ( ) { boolean runOnStartup = pref . getBoolean ( "runOnStartup" , true ) ; getRunOnStartupCheckBox ( ) . setSelected ( runOnStartup ) ; int maxCpus = pref . getInt ( "maxCpus" , 0 ) ; if ( maxCpus <= 0 ) { getLimitCpusCheckBox ( ) . setSelected ( false ) ; getMaxCpusTextField ( ) . setValue ( Runtime . getRuntime ( ) . availableProcessors ( ) ) ; getMaxCpusTextField ( ) . setEnabled ( false ) ; } else { getLimitCpusCheckBox ( ) . setSelected ( true ) ; getMaxCpusTextField ( ) . setValue ( maxCpus ) ; getMaxCpusTextField ( ) . setEnabled ( true ) ; } if ( getRequireACCheckBox ( ) . isEnabled ( ) ) { boolean requireAC = pref . getBoolean ( "requireAC" , false ) ; int minBattLife = pref . getInt ( "minBattLife" , 0 ) ; int minBattLifeWhileChg = pref . getInt ( "minBattLifeWhileChg" , 0 ) ; getRequireACCheckBox ( ) . setSelected ( requireAC ) ; getMinBatteryLifeSlider ( ) . setEnabled ( ! requireAC ) ; getMinBatteryLifeSlider ( ) . setValue ( minBattLife ) ; getMinBatteryLifeWhileChargingSlider ( ) . setValue ( minBattLifeWhileChg ) ; } else { getRequireACCheckBox ( ) . setSelected ( false ) ; getMinBatteryLifeSlider ( ) . setValue ( 0 ) ; getMinBatteryLifeWhileChargingSlider ( ) . setValue ( 0 ) ; getRequireACCheckBox ( ) . setEnabled ( false ) ; getMinBatteryLifeSlider ( ) . setEnabled ( false ) ; getMinBatteryLifeWhileChargingSlider ( ) . setEnabled ( false ) ; } boolean cacheClassDefinitions = pref . getBoolean ( "cacheClassDefinitions" , true ) ; getCacheClassDefinitionsCheckBox ( ) . setSelected ( cacheClassDefinitions ) ; }
Updates the form elements based on preferences .