Package mars.settings

Class FontSetting

java.lang.Object
mars.settings.FontSetting

public class FontSetting extends Object
Class representing a persistent font setting and its current value.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Font
    decode(String string)
    Decode a Font object from a string with the form Name or Name;Attributes, where Attributes is a comma-separated list of optional attributes: Bold: If present, sets the bold style flag.
    static String
    encode(Font font)
    Encode a Font object as a string with the form Name or Name;Attributes, where Attributes is a comma-separated list of optional attributes: Bold: Will be present if the bold style flag is set.
    get()
    Get the value currently stored in this setting.
    Get the default value for this setting.
    Get the key used to identify this setting in Preferences.
    void
    set(Font value)
    Set the value of this setting, updating persistent storage.
    void
    Set the default value for this setting without updating the current value.
    void
    Set the value of this setting without updating persistent storage.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getKey

      public String getKey()
      Get the key used to identify this setting in Preferences.
      Returns:
      The string key for this setting.
    • get

      public Font get()
      Get the value currently stored in this setting.
      Returns:
      The font value for this setting.
    • set

      public void set(Font value)
      Set the value of this setting, updating persistent storage.
      Parameters:
      value - The new font value for this setting.
    • getDefault

      public Font getDefault()
      Get the default value for this setting.
      Returns:
      The default font value for this setting.
    • setDefault

      public void setDefault(Font value)
      Set the default value for this setting without updating the current value.
      Parameters:
      value - The new font string value for this setting.
    • setNonPersistent

      public void setNonPersistent(Font value)
      Set the value of this setting without updating persistent storage.
      Parameters:
      value - The new font value for this setting.
    • encode

      public static String encode(Font font)
      Encode a Font object as a string with the form Name or Name;Attributes, where Attributes is a comma-separated list of optional attributes:
      • Bold: Will be present if the bold style flag is set.
      • Italic: Will be present if the italic style flag is set.
      • Size=N: Specifies the font point size N.
      Parameters:
      font - The font to encode as a string.
      Returns:
      The encoded form of the given font, or null if the font is null.
      See Also:
    • decode

      public static Font decode(String string)
      Decode a Font object from a string with the form Name or Name;Attributes, where Attributes is a comma-separated list of optional attributes:
      • Bold: If present, sets the bold style flag.
      • Italic: If present, sets the italic style flag.
      • Size=N: Sets the font point size to N. If not present, defaults to 12.
      Parameters:
      string - The string to decode as a font.
      Returns:
      The font decoded from the given string.
      See Also: