Package ij

Class Prefs


public class Prefs
extends Object
This class contains the ImageJ preferences, which are loaded from the "IJ_Props.txt" and "IJ_Prefs.txt" files.
See Also:
ImageJ
  • Field Details

  • Constructor Details

  • Method Details

    • load

      public static String load​(Object ij, Applet applet)
      Finds and loads the configuration file ("IJ_Props.txt") and the preferences file ("IJ_Prefs.txt").
      Returns:
      an error message if "IJ_Props.txt" not found.
    • getImagesURL

      public static String getImagesURL()
      Returns the URL of the directory that contains the ImageJ sample images.
    • setImagesURL

      public static void setImagesURL​(String url)
      Sets the URL of the directory that contains the ImageJ sample images.
    • getHomeDir

      public static String getHomeDir()
      Obsolete, replaced by getImageJDir(), which, unlike this method, returns a path that ends with File.separator.
    • getImageJDir

      public static String getImageJDir()
      Returns the path, ending in File.separator, to the ImageJ directory.
    • getPrefsDir

      public static String getPrefsDir()
      Returns the path to the directory where the preferences file (IJPrefs.txt) is saved.
    • getDefaultDirectory

      public static String getDefaultDirectory()
      Returns the default directory, if any, or null.
    • getString

      public static String getString​(String key)
      Finds a string in IJ_Props or IJ_Prefs.txt.
    • getString

      public static String getString​(String key, String defaultString)
      Finds an string in IJ_Props or IJ_Prefs.txt.
    • getBoolean

      public static boolean getBoolean​(String key, boolean defaultValue)
      Finds a boolean in IJ_Props or IJ_Prefs.txt.
    • getInt

      public static int getInt​(String key, int defaultValue)
      Finds an int in IJ_Props or IJ_Prefs.txt.
    • getDouble

      public static double getDouble​(String key, double defaultValue)
      Looks up a real number in IJ_Props or IJ_Prefs.txt.
    • getColor

      public static Color getColor​(String key, Color defaultColor)
      Finds a color in IJ_Props or IJ_Prefs.txt.
    • getFileSeparator

      public static String getFileSeparator()
      Returns the file.separator system property.
    • savePreferences

      public static void savePreferences()
      Saves user preferences in the IJ_Prefs.txt properties file.
    • resetPreferences

      public static void resetPreferences()
      Delete the preferences file when ImageJ quits.
    • set

      public static void set​(String key, String text)
      Saves the value of the string text in the preferences file using the keyword key. This string can be retrieved using the appropriate get() method.
    • set

      public static void set​(String key, int value)
      Saves value in the preferences file using the keyword key. This value can be retrieved using the appropriate getPref() method.
    • set

      public static void set​(String key, double value)
      Saves value in the preferences file using the keyword key. This value can be retrieved using the appropriate getPref() method.
    • set

      public static void set​(String key, boolean value)
      Saves the boolean variable value in the preferences file using the keyword key. This value can be retrieved using the appropriate getPref() method.
    • get

      public static String get​(String key, String defaultValue)
      Uses the keyword key to retrieve a string from the preferences file. Returns defaultValue if the key is not found.
    • get

      public static double get​(String key, double defaultValue)
      Uses the keyword key to retrieve a number from the preferences file. Returns defaultValue if the key is not found.
    • get

      public static boolean get​(String key, boolean defaultValue)
      Uses the keyword key to retrieve a boolean from the preferences file. Returns defaultValue if the key is not found.
    • saveLocation

      public static void saveLocation​(String key, Point loc)
      Saves the Point loc in the preferences file as a string using the keyword key.
    • getLocation

      public static Point getLocation​(String key)
      Uses the keyword key to retrieve a location from the preferences file. Returns null if the key is not found or the location is not valid (e.g., offscreen).
    • savePrefs

      public static void savePrefs​(Properties prefs, String path) throws IOException
      Throws:
      IOException
    • getThreads

      public static int getThreads()
      Returns the number of threads used by PlugInFilters to process images and stacks.
    • setThreads

      public static void setThreads​(int n)
      Sets the number of threads (1-32) used by PlugInFilters to process stacks.
    • setTransparentIndex

      public static void setTransparentIndex​(int index)
      Sets the transparent index (0-255), or set to -1 to disable transparency.
    • getTransparentIndex

      public static int getTransparentIndex()
      Returns the transparent index (0-255), or -1 if transparency is disabled.
    • getControlPanelProperties

      public static Properties getControlPanelProperties()
    • defaultResultsExtension

      public static String defaultResultsExtension()
    • setGuiScale

      public static void setGuiScale​(double scale)
      Sets the GenericDialog and Command Finder text scale (0.5 to 3.0).
    • getGuiScale

      public static double getGuiScale()
      Returns the GenericDialog and Command Finder text scale.
    • getCustomPropsPath

      public static String getCustomPropsPath()
      Returns the custom properties (IJ_Props.txt) file path.
    • getCustomPrefsPath

      public static String getCustomPrefsPath()
      Returns the custom preferences (IJ_Prefs.txt) file path.