-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
115 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,6 @@ hs_err_pid* | |
# IntelliJ | ||
/out/ | ||
.idea/ | ||
*.iml | ||
*.iml | ||
|
||
*.dat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
package com.stirante.RuneChanger.gui; | ||
|
||
public class Constants { | ||
//Button width | ||
public static final int BUTTON_WIDTH = 190; | ||
//Height of single element | ||
public static final int ELEMENT_HEIGHT = 30; | ||
public static final int WINDOW_WIDTH = 280; | ||
public static final int ELEMENT_WIDTH = 192; | ||
public static final int ELEMENT_OFFSET_X = 81; | ||
public static final int ELEMENT_OFFSET_Y = 37; | ||
public static final int ELEMENT_HEIGHT = 37; | ||
public static final int ICON_SIZE = 28; | ||
|
||
//Button position percentage relative to client window | ||
public static final double X_PER = 0.370d; | ||
public static final double Y_PER = 0.920d; | ||
//Button margin | ||
public static final double X_PER = 0.305d; | ||
public static final double Y_PER = 0.97d; | ||
|
||
public static final int MARGIN = 10; | ||
|
||
//version string | ||
public static final String VERSION_STRING = "1.1"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/com/stirante/RuneChanger/util/SimplePreferences.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.stirante.RuneChanger.util; | ||
|
||
import java.io.*; | ||
import java.util.HashMap; | ||
|
||
public class SimplePreferences { | ||
|
||
private static HashMap<String, Object> values; | ||
|
||
public static void load() { | ||
File prefs = new File("RuneChanger.dat"); | ||
try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(prefs))) { | ||
values = (HashMap<String, Object>) ois.readObject(); | ||
} catch (IOException | ClassNotFoundException e) { | ||
if (!(e instanceof FileNotFoundException)) | ||
e.printStackTrace(); | ||
} | ||
if (values == null) | ||
values = new HashMap<>(); | ||
} | ||
|
||
public static Object getValue(String key) { | ||
return values.get(key); | ||
} | ||
|
||
public static boolean containsKey(String key) { | ||
return values.containsKey(key); | ||
} | ||
|
||
public static void putValue(String key, Object value) { | ||
values.put(key, value); | ||
save(); | ||
} | ||
|
||
public static void removeValue(String key) { | ||
values.remove(key); | ||
save(); | ||
} | ||
|
||
public static void save() { | ||
File prefs = new File("RuneChanger.dat"); | ||
if (!prefs.exists()) { | ||
try { | ||
prefs.createNewFile(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(prefs))) { | ||
oos.writeObject(values); | ||
oos.flush(); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
|
||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters