com.jgoodies.uif.laf
Class ExtUIManager

java.lang.Object
  extended by com.jgoodies.uif.laf.ExtUIManager

public final class ExtUIManager
extends Object

A helper class that configures Swing related look issues:

  1. installs new look and feels.
  2. sets system properties,
  3. restores a look and feel with an optional theme, and
  4. overrides UI defaults.

Version:
$Revision: 1.12 $
Author:
Karsten Lentzsch
See Also:
LookChoiceStrategy, LookChoiceStrategies, LookConfiguration, LookConfigurations, UIManager

Field Summary
static String DEFAULT_LAF_KEY
          A key for the user preferences used to store and restore the classname of the default Look&Feel.
 
Method Summary
static LookAndFeel createLookAndFeelInstance(String className)
          Creates and returns an instance of LookAndFeel for the specified class name.
static LookAndFeel getDefaultLookAndFeel()
          Looks up the class name of the default Look&Feel, then create and returns an instance of this class.
static String getDefaultLookClassName()
          Looks up and returns the Look&Feel name as provided by the current LookChoiceStrategy.
static LookChoiceStrategy getLookChoiceStrategy()
          Returns the current LookChoiceStrategy.
static LookConfigurations getLookConfigurations()
          Returns a clone of the LookConfigurations object which is lazily initialized with default values.
static LookAndFeel getStoredLookAndFeel()
          Looks up the class name of the default Look&Feel, then create and returns an instance of this class.
static String getStoredLookClassName()
          Looks up and returns the class name of the Look&Feel that has been stored in the user preferences.
static LookConfiguration getStoredLookConfiguration()
          Looks up and returns the default LookConfiguration, that is the default Look&Feel plus theme - if any.
static List getSupportedLookAndFeelInstances()
          Lazily initializes and returns the list of supported look and feels sorted by name.
static List lookupSupportedLookAndFeelInstances()
          Looks up and returns a list of supported look&feels.
static void setLookChoiceStrategy(LookChoiceStrategy strategy)
          Sets a LookChoiceStrategy that will be used to lookup the very first look, if no look has been stored.
static void setLookConfigurations(LookConfigurations newLookConfigurations)
          Sets a new LookConfigurations object, stores them in the ApplicationContext's user preferences, sets the look and theme and finally updates all component tree UIs.
static void setStoredLookAndFeel(LookAndFeel laf)
          Stores the given LookAndFeel as default in the user preferences.
static void setStoredLookConfiguration(LookConfiguration lookConfiguration)
          Sets the LookConfiguration used as default.
static void setup()
          Installs the Plastic L&Fs, enables system fonts, restores the LookConfigurations from the application preferences and finally sets the selected look and theme.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LAF_KEY

public static final String DEFAULT_LAF_KEY
A key for the user preferences used to store and restore the classname of the default Look&Feel.

See Also:
getDefaultLookClassName(), getDefaultLookAndFeel(), getStoredLookConfiguration(), Constant Field Values
Method Detail

getLookChoiceStrategy

public static LookChoiceStrategy getLookChoiceStrategy()
Returns the current LookChoiceStrategy.

Returns:
the current LookChoiceStrategy.

setLookChoiceStrategy

public static void setLookChoiceStrategy(LookChoiceStrategy strategy)
Sets a LookChoiceStrategy that will be used to lookup the very first look, if no look has been stored.

Parameters:
strategy - the LookChoiceStrategy used to lookup the very first look

getLookConfigurations

public static LookConfigurations getLookConfigurations()
Returns a clone of the LookConfigurations object which is lazily initialized with default values.

Returns:
a clone of the LookConfigurations

setLookConfigurations

public static void setLookConfigurations(LookConfigurations newLookConfigurations)
Sets a new LookConfigurations object, stores them in the ApplicationContext's user preferences, sets the look and theme and finally updates all component tree UIs. Does nothing if the new LookConfigurations equals the old configurations

Parameters:
newLookConfigurations - the LookConfigurations to set

setup

public static void setup()
Installs the Plastic L&Fs, enables system fonts, restores the LookConfigurations from the application preferences and finally sets the selected look and theme.

This method shall be called before the any UI components are created. Therefore we don't need to update the component tree UIs. In contrast, if you set a new LookConfigurations object later, we store it in the prefs and update the component tree UIs.

See Also:
setLookConfigurations(LookConfigurations), setStoredLookConfiguration(LookConfiguration)

getStoredLookClassName

public static String getStoredLookClassName()
Looks up and returns the class name of the Look&Feel that has been stored in the user preferences.

Returns:
the class name of the stored Look&Feel.

getDefaultLookClassName

public static String getDefaultLookClassName()
Looks up and returns the Look&Feel name as provided by the current LookChoiceStrategy.

Returns:
the class name of the LookChoiceStrategy's default Look&Feel.

getStoredLookAndFeel

public static LookAndFeel getStoredLookAndFeel()
Looks up the class name of the default Look&Feel, then create and returns an instance of this class. Returns the UIManager's current Look&Feel in case the above fails.

Returns:
the default Look&Feel

getDefaultLookAndFeel

public static LookAndFeel getDefaultLookAndFeel()
Looks up the class name of the default Look&Feel, then create and returns an instance of this class. Returns the UIManager's current Look&Feel in case the above fails.

Returns:
the default Look&Feel

getStoredLookConfiguration

public static LookConfiguration getStoredLookConfiguration()
Looks up and returns the default LookConfiguration, that is the default Look&Feel plus theme - if any.

Returns:
the default LookConfiguration, i.e. L&F plus theme.

setStoredLookAndFeel

public static void setStoredLookAndFeel(LookAndFeel laf)
Stores the given LookAndFeel as default in the user preferences.

Parameters:
laf - the LookAndFeel to be set as default

setStoredLookConfiguration

public static void setStoredLookConfiguration(LookConfiguration lookConfiguration)
Sets the LookConfiguration used as default. Used in this class' #setup to determine the default look&feel plus theme. Also used when restoring look configurations from the user preferences.

Parameters:
lookConfiguration - the configuration used as default

createLookAndFeelInstance

public static LookAndFeel createLookAndFeelInstance(String className)
Creates and returns an instance of LookAndFeel for the specified class name. Before the class is loaded, the given class name may be replaced as defined in the JGoodies Looks Options class. For example the Sun Windows L&F is replaced by the JGoodies Windows L&F.

Parameters:
className - the name of the class to be instantiated
Returns:
the LookAndFeel instance for the given class name, a replacement applied

lookupSupportedLookAndFeelInstances

public static List lookupSupportedLookAndFeelInstances()
Looks up and returns a list of supported look&feels.

Returns:
a list of supported look&feels.

getSupportedLookAndFeelInstances

public static List getSupportedLookAndFeelInstances()
Lazily initializes and returns the list of supported look and feels sorted by name.

Returns:
a List of the supported look&feels


Copyright © 2000-2008 JGoodies Karsten Lentzsch. All Rights Reserved.