com.jme3.system.AppSettings.put()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(101)

本文整理了Java中com.jme3.system.AppSettings.put()方法的一些代码示例,展示了AppSettings.put()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AppSettings.put()方法的具体详情如下:
包路径:com.jme3.system.AppSettings
类名称:AppSettings
方法名:put

AppSettings.put介绍

[英]Set a boolean on the settings.
[中]在设置上设置一个布尔值。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Set a string on the settings.
 */
public void putString(String key, String value) {
  put(key, value);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

settings.putString("TestStr", "HelloWorld");
settings.putFloat("TestFloat", 123.567f);
settings.put("TestObj", new Mesh()); // Objects not supported by file settings

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * 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);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Sets the application icons to be used, with the most preferred first.
 * For Windows you should supply at least one 16x16 icon and one 32x32. The former is used for the title/task bar,
 * the latter for the alt-tab icon.
 * Linux (and similar platforms) expect one 32x32 icon.
 * Mac OS X should be supplied one 128x128 icon.
 * <br/>
 * The icon is used for the settings window, and the LWJGL render window. Not currently supported for JOGL.
 * Note that a bug in Java 6 (bug ID 6445278, currently hidden but available in Google cache) currently prevents
 * the icon working for alt-tab on the settings dialog in Windows.
 *
 * @param value An array of BufferedImages to use as icons.
 * (Default: not set)
 */
public void setIcons(Object[] value) {
  put("Icons", value);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Set a custom graphics renderer to use. The class should implement
 * the {@link JmeContext} interface.
 * @param clazz The custom context class.
 * (Default: not set)
 */
public void setCustomRenderer(Class<? extends JmeContext> clazz){
  put("Renderer", "CUSTOM" + clazz.getName());
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Set a boolean on the settings.
 */
public void putBoolean(String key, boolean value) {
  put(key, Boolean.valueOf(value));
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Set an integer on the settings.
 */
public void putInteger(String key, int value) {
  put(key, Integer.valueOf(value));
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Set a float on the settings.
 */
public void putFloat(String key, float value) {
  put(key, Float.valueOf(value));
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

put(key.substring(2), prefs.getInt(key, (Integer) 0));
    break;
  case 'F':
    put(key.substring(2), prefs.getFloat(key, (Float) 0f));
    break;
  case 'S':
    put(key.substring(2), prefs.get(key, (String) null));
    break;
  case 'B':
    put(key.substring(2), prefs.getBoolean(key, (Boolean) false));
    break;
  default:
  put(key, prefs.getInt(key, (Integer) defaultValue));
} else if (defaultValue instanceof String) {
  put(key, prefs.get(key, (String) defaultValue));
} else if (defaultValue instanceof Boolean) {
  put(key, prefs.getBoolean(key, (Boolean) defaultValue));

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

/**
 * Same as {@link #copyFrom(com.jme3.system.AppSettings) }, except
 * doesn't overwrite settings that are already set.
 *
 * @param other  The AppSettings to merge the settings from
 */
public void mergeFrom(AppSettings other) {
  for (String key : other.keySet()) {
    if( !this.containsKey(key) ) {
      put(key, other.get(key));
    }
  }
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * Set a string on the settings.
 */
public void putString(String key, String value) {
  put(key, value);
}

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * Set a string on the settings.
 */
public void putString(String key, String value) {
  put(key, value);
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * Set a float on the settings.
 */
public void putFloat(String key, float value) {
  put(key, Float.valueOf(value));
}

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * Set a custom graphics renderer to use. The class should implement 
 * the {@link JmeContext} interface.
 * @param clazz The custom context class.
 * (Default: not set)
 */
public void setCustomRenderer(Class<? extends JmeContext> clazz){
  put("Renderer", "CUSTOM" + clazz.getName());
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * Set an integer on the settings.
 */
public void putInteger(String key, int value) {
  put(key, Integer.valueOf(value));
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * Set a boolean on the settings.
 */
public void putBoolean(String key, boolean value) {
  put(key, Boolean.valueOf(value));
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * Set a custom graphics renderer to use. The class should implement
 * the {@link JmeContext} interface.
 * @param clazz The custom context class.
 * (Default: not set)
 */
public void setCustomRenderer(Class<? extends JmeContext> clazz){
  put("Renderer", "CUSTOM" + clazz.getName());
}

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * Set an integer on the settings.
 */
public void putInteger(String key, int value) {
  put(key, Integer.valueOf(value));
}

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * Set a boolean on the settings.
 */
public void putBoolean(String key, boolean value) {
  put(key, Boolean.valueOf(value));
}

代码示例来源:origin: info.projectkyoto/mms-engine

/**
 * Same as {@link #copyFrom(com.jme3.system.AppSettings) }, except
 * doesn't overwrite settings that are already set.
 * 
 * @param other  The AppSettings to merge the settings from
 */
public void mergeFrom(AppSettings other) {
  for (String key : other.keySet()) {
    if (get(key) == null) {
      put(key, other.get(key));
    }
  }
}

相关文章

AppSettings类方法