com.jgoodies.looks

## Class LookUtils

- java.lang.Object
- - com.jgoodies.common.base.SystemUtils
  - - com.jgoodies.looks.LookUtils

-     public final class LookUtils
      extends com.jgoodies.common.base.SystemUtils

  Provides convenience behavior used by the JGoodies Looks.
  Version:
    $Revision: 1.18 $
  Author:
    Karsten Lentzsch

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `IS_OS_WINDOWS_95` True if this is Windows 95.
    `static boolean` | `IS_OS_WINDOWS_MODERN` True if this is Windows 98/ME/2000/Server 2003/XP/VISTA/Server 2008.
    `static boolean` | `IS_OS_WINDOWS_NT` True if this is Windows NT.

    - ### Fields inherited from class com.jgoodies.common.base.SystemUtils

      `HAS_MODERN_RASTERIZER, IS_JAVA_6, IS_JAVA_7, IS_JAVA_7_OR_LATER, IS_JAVA_8, IS_JAVA_8_OR_LATER, IS_LAF_WINDOWS_XP_ENABLED, IS_LOW_RESOLUTION, IS_OS_LINUX, IS_OS_MAC, IS_OS_SOLARIS, IS_OS_WINDOWS, IS_OS_WINDOWS_2000, IS_OS_WINDOWS_6_OR_LATER, IS_OS_WINDOWS_7, IS_OS_WINDOWS_8, IS_OS_WINDOWS_98, IS_OS_WINDOWS_ME, IS_OS_WINDOWS_VISTA, IS_OS_WINDOWS_XP, IS_OS_WINDOWS_XP_64_BIT_OR_SERVER_2003, JAVA_VERSION, OS_NAME, OS_VERSION`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Boolean` | `getBooleanSystemProperty(String key, String logMessage)` Checks if a boolean system property has been set for the given key, and returns the associated Boolean, or `null` if no value has been set.
    `static Object` | `getDefaultTheme(LookAndFeel laf)`
    `static List` | `getInstalledThemes(LookAndFeel laf)`
    `static Color` | `getSlightlyBrighter(Color color)` Computes and returns a Color that is slightly brighter than the specified Color.
    `static Color` | `getSlightlyBrighter(Color color, float factor)` Computes and returns a Color that is slightly brighter than the specified Color.
    `static String` | `getSystemProperty(String key)` Tries to look up the System property for the given key.
    `static String` | `getSystemProperty(String key, String defaultValue)` Tries to look up the System property for the given key.
    `static boolean` | `getToolkitUsesNativeDropShadows()` Checks and answers whether this toolkit provides native drop shadows for popups such as the Mac OS X.
    `static boolean` | `isTrueColor(Component c)` Checks and answers whether we have a true color system.
    `static void` | `log()` Prints a new line to the console if logging is enabled.
    `static void` | `log(String message)` Prints the given message to the console if logging is enabled.
    `static void` | `setLoggingEnabled(boolean enabled)` Enables or disables the Looks logging.
    `static void` | `setLookAndTheme(LookAndFeel laf, Object theme)`

    - ### Methods inherited from class com.jgoodies.common.base.SystemUtils

      `isLafAqua, startsWith`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### IS_OS_WINDOWS_MODERN

          public static final boolean IS_OS_WINDOWS_MODERN

      True if this is Windows 98/ME/2000/Server 2003/XP/VISTA/Server 2008.

    - #### IS_OS_WINDOWS_95

          public static final boolean IS_OS_WINDOWS_95

      True if this is Windows 95.
      Since:
        2.0

    - #### IS_OS_WINDOWS_NT

          public static final boolean IS_OS_WINDOWS_NT

      True if this is Windows NT.
      Since:
        2.0

  - ### Method Detail

    - #### getSystemProperty

          public static String getSystemProperty(String key)

      Tries to look up the System property for the given key. In untrusted environments this may throw a SecurityException. In this case we catch the exception and answer `null`.
      Parameters:
        `key` - the name of the system property
      Returns:
        the system property's String value, or `null` if there's no such value, or a SecurityException has been caught

    - #### getSystemProperty

          public static String getSystemProperty(String key,
                                 String defaultValue)

      Tries to look up the System property for the given key. In untrusted environments this may throw a SecurityException. In this case, we catch the exception and answer the default value.
      Parameters:
        `key` - the name of the system property
        `defaultValue` - the default value if no property exists.
      Returns:
        the system property's String value, or the defaultValue if there's no such value, or a SecurityException has been caught

    - #### getBooleanSystemProperty

          public static Boolean getBooleanSystemProperty(String key,
                                         String logMessage)

      Checks if a boolean system property has been set for the given key, and returns the associated Boolean, or `null` if no value has been set. The test for the property ignores case. If a Boolean value has been set, a message is logged with the given prefix.
      Parameters:
        `key` - the key used to lookup the system property value
        `logMessage` - a prefix used when a message is logged
      Returns:
        `Boolean.TRUE` if the system property has been set to "true" (case ignored), `Boolean.FALSE` if it has been set to "false", `null` otherwise

    - #### isTrueColor

          public static boolean isTrueColor(Component c)

      Checks and answers whether we have a true color system.
      Parameters:
        `c` - the component used to determine the toolkit
      Returns:
        true if the component's toolkit has a pixel size >= 24

    - #### getToolkitUsesNativeDropShadows

          public static boolean getToolkitUsesNativeDropShadows()

      Checks and answers whether this toolkit provides native drop shadows for popups such as the Mac OS X. Currently this is used to determine if the Looks' popup drop shadow feature is active or not - even if it's enabled.
      Returns:
        true if the toolkit provides native drop shadows
      See Also:
        `Options.isPopupDropShadowActive()`

    - #### getSlightlyBrighter

          public static Color getSlightlyBrighter(Color color)

      Computes and returns a Color that is slightly brighter than the specified Color.
      Parameters:
        `color` - the color used as basis for the brightened color
      Returns:
        a slightly brighter color

    - #### getSlightlyBrighter

          public static Color getSlightlyBrighter(Color color,
                                  float factor)

      Computes and returns a Color that is slightly brighter than the specified Color.
      Parameters:
        `color` - the color used as basis for the brightened color
        `factor` - the factor used to compute the brightness
      Returns:
        a slightly brighter color

    - #### setLookAndTheme

          public static void setLookAndTheme(LookAndFeel laf,
                             Object theme)
                                      throws UnsupportedLookAndFeelException

      Throws:
        `UnsupportedLookAndFeelException`

    - #### getDefaultTheme

          public static Object getDefaultTheme(LookAndFeel laf)

    - #### getInstalledThemes

          public static List getInstalledThemes(LookAndFeel laf)

    - #### setLoggingEnabled

          public static void setLoggingEnabled(boolean enabled)

      Enables or disables the Looks logging.
      Parameters:
        `enabled` - true to enable logging, false to disable it

    - #### log

          public static void log()

      Prints a new line to the console if logging is enabled.

    - #### log

          public static void log(String message)

      Prints the given message to the console if logging is enabled.
      Parameters:
        `message` - the message to print

Copyright © 2001-2014 JGoodies Software GmbH. All Rights Reserved.