try { in = appCfg.openStream(); settings.load(in); in.close(); } catch (IOException ex){
try { InputStream in = appCfg.openStream(); settings.load(in); in.close(); } catch (IOException ex){
try { ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); loadedSettings.load(bais); } catch (IOException ex) { ex.printStackTrace();
registrySettings.load(appTitle); } catch (BackingStoreException ex) { logger.log(Level.WARNING,
/** * Tests preference based AppSettings. */ private static void testPreferenceSettings() { AppSettings settings = new AppSettings(false); settings.putBoolean("TestBool", true); settings.putInteger("TestInt", 123); settings.putString("TestStr", "HelloWorld"); settings.putFloat("TestFloat", 123.567f); settings.put("TestObj", new Mesh()); // Objects not supported by preferences try { settings.save(APPSETTINGS_KEY); } catch (BackingStoreException ex) { ex.printStackTrace(); } AppSettings loadedSettings = new AppSettings(false); try { loadedSettings.load(APPSETTINGS_KEY); } catch (BackingStoreException ex) { ex.printStackTrace(); } assertEqual(loadedSettings.getBoolean("TestBool"), true); assertEqual(loadedSettings.getInteger("TestInt"), 123); assertEqual(loadedSettings.getString("TestStr"), "HelloWorld"); assertEqual(loadedSettings.get("TestFloat"), 123.567f); }
private void loadSettings() { // Init the application settings which contain just the conversion & folder data File settingsFile = new File(SETTINGS_FILE); if (settingsFile.exists()) { try (InputStream is = new FileInputStream(settingsFile)) { settings.load(is); } catch (IOException ex) { LOGGER.log(java.util.logging.Level.WARNING, "Settings file failed to load from " + settingsFile + "!", ex); } } }
private Settings(final AppSettings settings) { // Init the settings this.settings = settings; //Default resolution if (!this.settings.containsKey("Width") || !this.settings.containsKey("Height")) { this.settings.setResolution(800, 600); // Default resolution } File settingsFile = new File(USER_SETTINGS_FILE); if (settingsFile.exists()) { try (InputStream is = new FileInputStream(settingsFile)) { this.settings.load(is); } catch (IOException ex) { LOGGER.log(java.util.logging.Level.WARNING, "Settings file failed to load from " + settingsFile + "!", ex); } } this.settings.setFrameRate(Math.max(MAX_FPS, settings.getFrequency())); // Assing some app level settings settings.setTitle(TITLE); settings.setIcons(getApplicationIcons()); }
try { in = appCfg.openStream(); settings.load(in); in.close(); } catch (IOException ex){
registrySettings.load(appTitle); } catch (BackingStoreException ex) { logger.log(Level.WARNING,
registrySettings.load(appTitle); } catch (BackingStoreException ex) { logger.log(Level.WARNING,