Class ColorResource


  • public class ColorResource
    extends Resource
    A Resource wrapping a Color.
    See Also:
    Resource, Color
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.awt.Color color  
      private static java.util.logging.Logger logger  
      static java.awt.Color REPLACEMENT_COLOR  
      static java.lang.String SCHEME  
    • Constructor Summary

      Constructors 
      Constructor Description
      ColorResource​(java.lang.String primaryKey, java.awt.Color color)  
      ColorResource​(java.lang.String primaryKey, java.net.URI resourceLocator)
      Do not use directly.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static java.awt.Color createColor​(java.lang.String colorName)
      Returns the Color identified by the given string.
      java.awt.Color getColor()
      Gets the Color represented by this resource.
      private static boolean isHexString​(java.lang.String str)  
      void preload()
      Preload the resource if possible/meaningful.
      • Methods inherited from class java.lang.Object

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

      • logger

        private static final java.util.logging.Logger logger
      • REPLACEMENT_COLOR

        public static final java.awt.Color REPLACEMENT_COLOR
      • color

        private final java.awt.Color color
    • Constructor Detail

      • ColorResource

        public ColorResource​(java.lang.String primaryKey,
                             java.awt.Color color)
      • ColorResource

        public ColorResource​(java.lang.String primaryKey,
                             java.net.URI resourceLocator)
        Do not use directly.
        Parameters:
        primaryKey - The primary key.
        resourceLocator - The URI used when loading this resource.
    • Method Detail

      • preload

        public void preload()
        Preload the resource if possible/meaningful.
        Specified by:
        preload in class Resource
      • getColor

        public java.awt.Color getColor()
        Gets the Color represented by this resource.
        Returns:
        The Color in it's original size.
      • isHexString

        private static boolean isHexString​(java.lang.String str)
      • createColor

        private static java.awt.Color createColor​(java.lang.String colorName)
        Returns the Color identified by the given string. This is either a hexadecimal integer prefixed with "0x", or the name of a field of the Color class.
        Parameters:
        colorName - a String value
        Returns:
        a Color value