public static void save() { RegistryKey key = new RegistryKey(RootKey.HKEY_CURRENT_USER, "Software\\J Develop Station\\L2InfoJ"); if (!key.exists()) { key.create(); } key.setValue(new RegistryValue("DeviceId", DEVICE_ID)); key.setValue(new RegistryValue("UserName", USER_NAME)); key.setValue(new RegistryValue("UseTray", USE_TRAY ? 1 : 0)); key.setValue(new RegistryValue("X", X)); key.setValue(new RegistryValue("Y", Y)); }
public static void load() { RegistryKey key = new RegistryKey(RootKey.HKEY_CURRENT_USER, "Software\\J Develop Station\\L2InfoJ"); if (!key.exists()) return; if (key.hasValue("DeviceId")) { DEVICE_ID = (Integer) key.getValue("DeviceId").getData(); } if (key.hasValue("UseTray")) { USE_TRAY = ((Integer) key.getValue("UseTray").getData()) == 1; } if (key.hasValue("UserName")) { USER_NAME = (String) key.getValue("UserName").getData(); } if (key.hasValue("X")) { X = (Integer) key.getValue("X").getData(); } if (key.hasValue("Y")) { Y = (Integer) key.getValue("Y").getData(); } }