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.SystemUtilsProvides convenience behavior used by the JGoodies Looks.- Version:
- $Revision: 1.18 $
-
-
Field Summary
Fields Modifier and Type Field Description static booleanIS_OS_WINDOWS_95True if this is Windows 95.static booleanIS_OS_WINDOWS_MODERNTrue if this is Windows 98/ME/2000/Server 2003/XP/VISTA/Server 2008.static booleanIS_OS_WINDOWS_NTTrue if this is Windows NT.private static booleanloggingEnabled-
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 Modifier Constructor Description privateLookUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.BooleangetBooleanSystemProperty(java.lang.String key, java.lang.String logMessage)Checks if a boolean system property has been set for the given key, and returns the associated Boolean, ornullif no value has been set.static java.lang.ObjectgetDefaultTheme(javax.swing.LookAndFeel laf)static java.util.ListgetInstalledThemes(javax.swing.LookAndFeel laf)static java.awt.ColorgetSlightlyBrighter(java.awt.Color color)Computes and returns a Color that is slightly brighter than the specified Color.static java.awt.ColorgetSlightlyBrighter(java.awt.Color color, float factor)Computes and returns a Color that is slightly brighter than the specified Color.static java.lang.StringgetSystemProperty(java.lang.String key)Tries to look up the System property for the given key.static java.lang.StringgetSystemProperty(java.lang.String key, java.lang.String defaultValue)Tries to look up the System property for the given key.static booleangetToolkitUsesNativeDropShadows()Checks and answers whether this toolkit provides native drop shadows for popups such as the Mac OS X.static booleanisTrueColor(java.awt.Component c)Checks and answers whether we have a true color system.static voidlog()Prints a new line to the console if logging is enabled.static voidlog(java.lang.String message)Prints the given message to the console if logging is enabled.static voidsetLoggingEnabled(boolean enabled)Enables or disables the Looks logging.static voidsetLookAndTheme(javax.swing.LookAndFeel laf, java.lang.Object theme)
-
-
-
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
-
loggingEnabled
private static boolean loggingEnabled
-
-
Method Detail
-
getSystemProperty
public static java.lang.String getSystemProperty(java.lang.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 answernull.- Parameters:
key- the name of the system property- Returns:
- the system property's String value, or
nullif there's no such value, or a SecurityException has been caught
-
getSystemProperty
public static java.lang.String getSystemProperty(java.lang.String key, java.lang.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 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
public static java.lang.Boolean getBooleanSystemProperty(java.lang.String key, java.lang.String logMessage)Checks if a boolean system property has been set for the given key, and returns the associated Boolean, ornullif 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.TRUEif the system property has been set to "true" (case ignored),Boolean.FALSEif it has been set to "false",nullotherwise
-
isTrueColor
public static boolean isTrueColor(java.awt.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 java.awt.Color getSlightlyBrighter(java.awt.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 java.awt.Color getSlightlyBrighter(java.awt.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 colorfactor- the factor used to compute the brightness- Returns:
- a slightly brighter color
-
setLookAndTheme
public static void setLookAndTheme(javax.swing.LookAndFeel laf, java.lang.Object theme) throws javax.swing.UnsupportedLookAndFeelException- Throws:
javax.swing.UnsupportedLookAndFeelException
-
getDefaultTheme
public static java.lang.Object getDefaultTheme(javax.swing.LookAndFeel laf)
-
getInstalledThemes
public static java.util.List getInstalledThemes(javax.swing.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(java.lang.String message)
Prints the given message to the console if logging is enabled.- Parameters:
message- the message to print
-
-