Class ResourceBundleAccessor

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.ResourceBundle bundle  
    • Constructor Summary

      Constructors 
      Constructor Description
      ResourceBundleAccessor​(java.util.ResourceBundle bundle)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.swing.Icon getIcon​(java.lang.String key)
      Returns the Icon resource associated with the given key.
      java.lang.String getString​(java.lang.String key, java.lang.Object... args)
      Looks up and returns a String associated with the given resource key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • bundle

        private final java.util.ResourceBundle bundle
    • Constructor Detail

      • ResourceBundleAccessor

        public ResourceBundleAccessor​(java.util.ResourceBundle bundle)
    • Method Detail

      • getIcon

        public javax.swing.Icon getIcon​(java.lang.String key)
        Description copied from interface: IconResourceAccessor
        Returns the Icon resource associated with the given key.
        Specified by:
        getIcon in interface IconResourceAccessor
        Parameters:
        key - the key used to look up the Icon
        Returns:
        the Icon
      • getString

        public java.lang.String getString​(java.lang.String key,
                                          java.lang.Object... args)
        Looks up and returns a String associated with the given resource key. If no arguments are provided, the plain String is returned. Otherwise the string will be formatted using String.format with the given arguments.

        In case the resource key is missing in the bundle, this implementation returns the key itself.

        Specified by:
        getString in interface StringResourceAccessor
        Parameters:
        key - the key in the resource bundle
        args - optional format arguments forwarded to String#format
        Returns:
        the String value found for the given resource key, formatted with the optional arguments - if any, or - if the key is missing in the bundle - the resource key itself
        See Also:
        String.format(String, Object...)