Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.jgoodies.looks
Class LookUtils

    java.lang.Object
      com.jgoodies.looks.LookUtils

public final class LookUtils
extends Object

Provides convenience behavior used by the JGoodies Looks.

Version:
  $Revision: 1.6 $
Author:
  Karsten Lentzsch
See Also:
  `FontUtils`

Field Summary
`static boolean` | `IS_JAVA_1_4` True if this is Java 1.4.
`static boolean` | `IS_JAVA_1_4_2_OR_LATER` True if this is Java 1.4.2 or later.
`static boolean` | `IS_JAVA_5` True if this is Java 5.x.
`static boolean` | `IS_LAF_WINDOWS_XP_ENABLED` True if the Windows XP Look&Feel is enabled.
`static boolean` | `IS_LOW_RESOLUTION` True if if the screen resolution is smaller than 120 dpi.
`static boolean` | `IS_OS_FREEBSD` True if this is FreeBSD.
`static boolean` | `IS_OS_LINUX` True if this is Linux.
`static boolean` | `IS_OS_MAC` True if this is the Mac OS X.
`static boolean` | `IS_OS_OS2` True if this is OS/2.
`static boolean` | `IS_OS_SOLARIS` True if this is Solaris.
`static boolean` | `IS_OS_WINDOWS` True if this is Windows.
`static boolean` | `IS_OS_WINDOWS_MODERN` True if this is Windows 98/ME/2000/XP.
`static boolean` | `IS_OS_WINDOWS_XP` True if this is Windows XP.

Method Summary
`static Insets` | `createButtonMargin(boolean narrow)` Creates and returns the margin used by JButton and JToggleButton.
`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 void` | `installNarrowMargin(AbstractButton b, String propertyPrefix)` Installs a narrow margin, if property `isNarrow` has been set.
`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 java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### IS_JAVA_1_4

    public static final boolean IS_JAVA_1_4

  True if this is Java 1.4.

### IS_JAVA_1_4_2_OR_LATER

    public static final boolean IS_JAVA_1_4_2_OR_LATER

  True if this is Java 1.4.2 or later. Since we assume Java 1.4 we just check for 1.4.0 and 1.4.1.

### IS_JAVA_5

    public static final boolean IS_JAVA_5

  True if this is Java 5.x. Java 5 still used the old version numbers, and so we check for a prefix of 1.5.

### IS_OS_FREEBSD

    public static final boolean IS_OS_FREEBSD

  True if this is FreeBSD.

### IS_OS_LINUX

    public static final boolean IS_OS_LINUX

  True if this is Linux.

### IS_OS_OS2

    public static final boolean IS_OS_OS2

  True if this is OS/2.

### IS_OS_MAC

    public static final boolean IS_OS_MAC

  True if this is the Mac OS X.

### IS_OS_WINDOWS

    public static final boolean IS_OS_WINDOWS

  True if this is Windows.

### IS_OS_WINDOWS_MODERN

    public static final boolean IS_OS_WINDOWS_MODERN

  True if this is Windows 98/ME/2000/XP.

### IS_OS_WINDOWS_XP

    public static final boolean IS_OS_WINDOWS_XP

  True if this is Windows XP.

### IS_OS_SOLARIS

    public static final boolean IS_OS_SOLARIS

  True if this is Solaris.

### IS_LAF_WINDOWS_XP_ENABLED

    public static final boolean IS_LAF_WINDOWS_XP_ENABLED

  True if the Windows XP Look&Feel is enabled.

### IS_LOW_RESOLUTION

    public static final boolean IS_LOW_RESOLUTION

  True if if the screen resolution is smaller than 120 dpi.

  See Also:
    `Toolkit.getScreenResolution()`

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 catched

### 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 catched

### 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

### installNarrowMargin

    public static void installNarrowMargin(AbstractButton b,
                                           String propertyPrefix)

  Installs a narrow margin, if property `isNarrow` has been set.

  Parameters:
    `b` - the button that shall get a narrow margin
    `propertyPrefix` - the component type prefeix for the UIDefaults

### createButtonMargin

    public static Insets createButtonMargin(boolean narrow)

  Creates and returns the margin used by JButton and JToggleButton. Honors the screen resolution and the global property `isNarrowButtonsEnabled`.

  Sun's L&F implementations use wide button margins.

  Parameters:
    `narrow` - true to create a narrow margin, false for a wide margin
  Returns:
    an Insets object used to create a button margin
  See Also:
    `Options.getUseNarrowButtons()`

### 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 JGoodies Karsten Lentzsch. All Rights Reserved.