public static int getHistorySize() { return prefs.getInt(PREF_HISTORY_SIZE, DEFAULT_HISTORY_SIZE); } public static void setHistorySize(int historySize) { prefs.putInt(PREF_HISTORY_SIZE, historySize); }
public static int getFontSize() { return prefs.getInt(PREF_FONT_SIZE, DEFAULT_FONT_SIZE); } public static void setFontSize(int fontSize) { prefs.putInt(PREF_FONT_SIZE, fontSize); }
public static int getMaxMatches() { return prefs.getInt(PREF_MAX_MATCHES, DEFAULT_MAX_MATCHES); } public static void setMaxMatches(int maxMatches) { prefs.putInt(PREF_MAX_MATCHES, maxMatches); }
public static Color getMatchedColor() { return new Color(prefs.getInt(PREF_MATCHED_COLOR, DEFAULT_MATCHED_COLOR)); } public static void setMatchedColor(Color matchedColor) { prefs.putInt(PREF_MATCHED_COLOR, matchedColor.getRGB()); }
public static Color getTreeColor() { return new Color(prefs.getInt(PREF_TREE_COLOR, DEFAULT_TREE_COLOR)); } public static void setTreeColor(Color treeColor) { prefs.putInt(PREF_TREE_COLOR, treeColor.getRGB()); }
public static Color getHighlightColor() { return new Color(prefs.getInt(PREF_HIGHLIGHT_COLOR, DEFAULT_HIGHLIGHT_COLOR)); } public static void setHighlightColor(Color highlightColor) { prefs.putInt(PREF_HIGHLIGHT_COLOR, highlightColor.getRGB()); }
private WindowPosition loadWindowPosition(Preferences prefs, String windowIdPrefix) { WindowPosition windowPosition = new WindowPosition(); windowPosition.setFullScreen(prefs.getBoolean(windowIdPrefix + WINDOW_IS_FULL_SCREEN_ID, false)); windowPosition.setWindowWidth(prefs.getInt(windowIdPrefix + WINDOW_WIDTH_ID, 0)); windowPosition.setWindowHeight(prefs.getInt(windowIdPrefix + WINDOW_HEIGHT_ID, 0)); windowPosition.setWindowX(prefs.getInt(windowIdPrefix + WINDOW_X_ID, 0)); windowPosition.setWindowY(prefs.getInt(windowIdPrefix + WINDOW_Y_ID, 0)); return windowPosition; }
private LuytenPreferences loadLuytenPreferences(Preferences prefs) throws Exception { LuytenPreferences newLuytenPrefs = new LuytenPreferences(); for (Field field : LuytenPreferences.class.getDeclaredFields()) { if (Modifier.isStatic(field.getModifiers())) continue; field.setAccessible(true); String prefId = field.getName(); Object defaultVal = field.get(newLuytenPrefs); if (field.getType() == String.class) { String defaultStr = (String) (defaultVal == null ? "" : defaultVal); field.set(newLuytenPrefs, prefs.get(prefId, defaultStr)); } else if (field.getType() == Boolean.class || field.getType() == boolean.class) { Boolean defaultBool = (Boolean) (defaultVal == null ? new Boolean(false) : defaultVal); field.setBoolean(newLuytenPrefs, prefs.getBoolean(prefId, defaultBool)); } else if (field.getType() == Integer.class || field.getType() == int.class) { Integer defaultInt = (Integer) (defaultVal == null ? new Integer(0) : defaultVal); field.setInt(newLuytenPrefs, prefs.getInt(prefId, defaultInt)); } } return newLuytenPrefs; }
public void changedUpdate(DocumentEvent documentEvent) { documentChangedSinceLastRepaint = true; int width = 3 * Preferences.userNodeForPackage(Console.class).getInt("fontSize", 12); numbersPanel.setPreferredSize(new Dimension(width, width)); } });
public LineNumbersPanel() { int initialSize = 3 * Preferences.userNodeForPackage(Console.class).getInt("fontSize", 12); setMinimumSize(new Dimension(initialSize, initialSize)); setPreferredSize(new Dimension(initialSize, initialSize)); }
/** * {@inheritDoc} * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#readFromPreferences(java.util.prefs.Preferences) */ public void readFromPreferences( final Preferences node ) { this.setValue( node.getInt( this.getKey(), this.getValue() ) ); }
Preferences.userNodeForPackage(Console.class).getInt("fontSize", 12)));
@Override public synchronized int getInt(String key, int defaultValue) { return this.preferences.getInt(key, defaultValue); }
@Override public synchronized byte getByte(String key, byte defaultValue) { int intValue = this.preferences.getInt(key, defaultValue); if (intValue < Byte.MIN_VALUE || intValue > Byte.MAX_VALUE) { throw new IllegalStateException("byte value out of range: " + intValue); } return (byte) intValue; }
/** Returns the default indentation. */ static int getIndentation() { try { return Preferences.userNodeForPackage(Formattable.class).getInt(INDENTATION, 2); } catch (SecurityException ignore) { // Ignore. Will fallback on the default indentation. return 2; } }
@Override public int getNumberOfLogRows() { return prefs.getInt(IntUserPreference.LOGVIEW_ROWS_NUMBER.toString(), 200); }
@Override public int getLatestImportantNewsSeen() { return Preferences.userRoot().node(NEWS_PATH).getInt(LATEST_IMPORTANT_NEWS_ID, -1); }
@Override public int getLatestNewsSeen() { return Preferences.userRoot().node(NEWS_PATH).getInt(LATEST_NEWS_ID, -1); }
private static void load(Preferences prefs, KeyBindButton button) { String key = button.getKey(); int prop = prefs.getInt(key, getDefaultControlKey(key)); button.setKeyCode(prop); }