Documentation of 'jas2.util.UserProperties' Java class
UserProperties
jas2.util

Class UserProperties

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Object,java.lang.Object>


    public class UserProperties
    extends java.util.Properties
    This class is used to store user prorerties. There is one instance for the application. The UserProperties object used is available from the Application object using a getUserProperties() method.
    See Also:
    Application, Application.getUserProperties(), Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      UserProperties()
      The Application object will create an instance for the application and save it just before the application closes.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean getBoolean(java.lang.String key, boolean def) 
      java.awt.Color getColor(java.lang.String key, java.awt.Color def) 
      float getFloat(java.lang.String key, float def) 
      int getInteger(java.lang.String key) 
      int getInteger(java.lang.String key, int def) 
      java.awt.Rectangle getRectangle(java.lang.String key, java.awt.Rectangle def) 
      java.lang.String getString(java.lang.String key, java.lang.String def) 
      java.lang.String[] getStringArray(java.lang.String key, java.lang.String[] def) 
      static UserProperties getUserProperties() 
      void save()
      Saves the properties.
      void setBoolean(java.lang.String key, boolean value) 
      void setColor(java.lang.String key, java.awt.Color c) 
      void setFloat(java.lang.String key, float f) 
      void setInteger(java.lang.String key, int i) 
      void setRectangle(java.lang.String key, java.awt.Rectangle rect) 
      void setString(java.lang.String key, java.lang.String s) 
      void setStringArray(java.lang.String key, java.lang.String[] sa) 
      static java.lang.String[] updateStringArray(java.lang.String[] oldArray, java.lang.String newString)
      This is a utility method for updating a string array of recently used items.
      static java.lang.String[] updateStringArray(java.lang.String[] oldArray, java.lang.String newString, int nStored)
      This is a utility method for updating a string array of recently used items.
      java.lang.String[] updateStringArray(java.lang.String[] oldArray, java.lang.String newString, java.lang.String lengthKey)
      This is a utility method for updating a string array of recently used items.
      • Methods inherited from class java.util.Properties

        getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
      • Methods inherited from class java.util.Hashtable

        clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, toString, values
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • UserProperties

        public UserProperties()
        The Application object will create an instance for the application and save it just before the application closes. Therefore, you should not have to use the constructor yourself. The UserProperties object used is available from the Application object using a getUserProperties() method.
        See Also:
        Application, Application.getUserProperties()
    • Method Detail

      • getRectangle

        public java.awt.Rectangle getRectangle(java.lang.String key,
                                               java.awt.Rectangle def)
        Parameters:
        key - the key used to store this property
        def - a default in case the property cannot be retrieved
      • setRectangle

        public void setRectangle(java.lang.String key,
                                 java.awt.Rectangle rect)
        Parameters:
        key - the key used to store this property
        rect - the value to store
      • getColor

        public java.awt.Color getColor(java.lang.String key,
                                       java.awt.Color def)
        Parameters:
        key - the key used to store this property
        def - a default in case the property cannot be retrieved
      • setColor

        public void setColor(java.lang.String key,
                             java.awt.Color c)
        Parameters:
        key - the key used to store this property
        c - the value to store
      • getStringArray

        public java.lang.String[] getStringArray(java.lang.String key,
                                                 java.lang.String[] def)
        Parameters:
        key - the key used to store this property
        def - a default in case the property cannot be retrieved
      • setStringArray

        public void setStringArray(java.lang.String key,
                                   java.lang.String[] sa)
        Parameters:
        key - the key used to store this property
        sa - the value to store
      • getString

        public java.lang.String getString(java.lang.String key,
                                          java.lang.String def)
        Parameters:
        key - the key used to store this property
        def - a default in case the property cannot be retrieved
      • setString

        public void setString(java.lang.String key,
                              java.lang.String s)
        Parameters:
        key - the key used to store this property
        s - the value to store
      • getBoolean

        public boolean getBoolean(java.lang.String key,
                                  boolean def)
        Parameters:
        key - the key used to store this property
        def - a default in case the property cannot be retrieved
      • setBoolean

        public void setBoolean(java.lang.String key,
                               boolean value)
        Parameters:
        key - the key used to store this property
        value - the value to store
      • getInteger

        public int getInteger(java.lang.String key)
                       throws java.lang.NumberFormatException
        Parameters:
        key - the key used to store this property
        Throws:
        java.lang.NumberFormatException - if the property retrieved cannot be converted to int
      • getInteger

        public int getInteger(java.lang.String key,
                              int def)
        Parameters:
        key - the key used to store this property
        def - a default in case the property cannot be retrieved
      • setFloat

        public void setFloat(java.lang.String key,
                             float f)
        Parameters:
        key - the key used to store this property
        f - the value to store
      • getFloat

        public float getFloat(java.lang.String key,
                              float def)
        Parameters:
        key - the key used to store this property
        def - a default in case the property cannot be retrieved
      • setInteger

        public void setInteger(java.lang.String key,
                               int i)
        Parameters:
        key - the key used to store this property
        i - the value to store
      • save

        public void save()
                  throws java.io.IOException
        Saves the properties. The application does this for you just before closing, so you don't have to call this method.
        Throws:
        java.io.IOException
      • updateStringArray

        public static java.lang.String[] updateStringArray(java.lang.String[] oldArray,
                                                           java.lang.String newString)
        This is a utility method for updating a string array of recently used items. Supply it with an old array and a new item. If the new item was already in the old array, then it is simply moved to the beginning. If it was not in the old array then it is placed at the front and the other items are shuffled back. The method will return an array with a maximum size of 4.
        Parameters:
        oldArray - the array to update (may safely be null)
        newString - the new item to include
        Returns:
        the updated array
      • updateStringArray

        public java.lang.String[] updateStringArray(java.lang.String[] oldArray,
                                                    java.lang.String newString,
                                                    java.lang.String lengthKey)
        This is a utility method for updating a string array of recently used items. Supply it with an old array and a new item. If the new item was already in the old array, then it is simply moved to the beginning. If it was not in the old array then it is placed at the front and the other items are shuffled back. The method will return an array with a maximum size defined by the integer stored by the given key, or 4 if such an integer cannot be found.
        Parameters:
        oldArray - the array to update (may safely be null)
        newString - the new item to include
        lengthKey - the key used to find the maximum length of the resulting array
        Returns:
        the updated array
      • updateStringArray

        public static java.lang.String[] updateStringArray(java.lang.String[] oldArray,
                                                           java.lang.String newString,
                                                           int nStored)
        This is a utility method for updating a string array of recently used items. Supply it with an old array and a new item. If the new item was already in the old array, then it is simply moved to the beginning. If it was not in the old array then it is placed at the front and the other items are shuffled back. The method will return an array of a maximum size given by the nStored parameter.
        Parameters:
        oldArray - the array to update (may safely be null)
        newString - the new item to include
        nStored - the maximum size of the updated array
        Returns:
        the updated array
      • getUserProperties

        public static UserProperties getUserProperties()

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.