Package 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 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
True if this is Windows 95.static final boolean
True if this is Windows 98/ME/2000/Server 2003/XP/VISTA/Server 2008.static final boolean
True if this is Windows NT.private static boolean
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Boolean
getBooleanSystemProperty
(String key, String logMessage) Checks if a boolean system property has been set for the given key, and returns the associated Boolean, ornull
if no value has been set.static Object
static List
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
Checks and answers whether this toolkit provides native drop shadows for popups such as the Mac OS X.static boolean
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
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
-
Field Details
-
IS_OS_WINDOWS_MODERN
public static final boolean IS_OS_WINDOWS_MODERNTrue if this is Windows 98/ME/2000/Server 2003/XP/VISTA/Server 2008. -
IS_OS_WINDOWS_95
public static final boolean IS_OS_WINDOWS_95True if this is Windows 95.- Since:
- 2.0
-
IS_OS_WINDOWS_NT
public static final boolean IS_OS_WINDOWS_NTTrue if this is Windows NT.- Since:
- 2.0
-
loggingEnabled
private static boolean loggingEnabled
-
-
Constructor Details
-
LookUtils
private LookUtils()
-
-
Method Details
-
getSystemProperty
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 answernull
.- 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
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 propertydefaultValue
- 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
Checks if a boolean system property has been set for the given key, and returns the associated Boolean, ornull
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 valuelogMessage
- 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
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:
-
getSlightlyBrighter
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
Computes and returns a Color that is slightly brighter than the specified Color.- Parameters:
color
- the color used as basis for the brightened colorfactor
- 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
-
getInstalledThemes
-
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
Prints the given message to the console if logging is enabled.- Parameters:
message
- the message to print
-