1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Preparing the ground for rewriting Preferences GUI code (and hopefully fixing the tiny-pref-window bug on macosx)

This commit is contained in:
Federico Fissore
2015-05-05 10:02:12 +02:00
parent 7e7a9d0fe8
commit 9b58812d1d
19 changed files with 149 additions and 206 deletions

View File

@ -2,6 +2,7 @@ package processing.app;
import static processing.app.I18n._;
import java.awt.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@ -12,6 +13,7 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.MissingResourceException;
import processing.app.helpers.PreferencesHelper;
import processing.app.helpers.PreferencesMap;
import processing.app.legacy.PApplet;
import processing.app.legacy.PConstants;
@ -179,6 +181,13 @@ public class PreferencesData {
return Integer.parseInt(get(attribute));
}
static public int getInteger(String attribute, int defaultValue) {
if (has(attribute)) {
return getInteger(attribute);
}
return defaultValue;
}
static public void setInteger(String key, int value) {
set(key, String.valueOf(value));
@ -203,4 +212,14 @@ public class PreferencesData {
{
doSave = value;
}
static public Font getFont(String attr) {
Font font = PreferencesHelper.getFont(prefs, attr);
if (font == null) {
String value = defaults.get(attr);
prefs.put(attr, value);
font = PreferencesHelper.getFont(prefs, attr);
}
return font;
}
}