org.jhotdraw.gui.plaf.palette
Class PaletteLookAndFeel

java.lang.Object
  extended by javax.swing.LookAndFeel
      extended by javax.swing.plaf.basic.BasicLookAndFeel
          extended by org.jhotdraw.gui.plaf.palette.PaletteLookAndFeel
All Implemented Interfaces:
java.io.Serializable

public class PaletteLookAndFeel
extends javax.swing.plaf.basic.BasicLookAndFeel

A LookAndFeel for components in the palette windows of a drawing editor.

Author:
Werner Randelshofer  @version $Id: PaletteLookAndFeel.java 538 2009-06-17 14:46:51Z rawcoder $
See Also:
Serialized Form

Field Summary
private  javax.swing.UIDefaults cachedDefaults
          Cached defaults.
private static PaletteLookAndFeel instance
          Shared instance.
 
Constructor Summary
PaletteLookAndFeel()
           
 
Method Summary
 java.lang.Object get(java.lang.Object key)
          Looks up up the given key in our Hashtable and resolves LazyValues or ActiveValues.
 boolean getBoolean(java.lang.String key)
           
 javax.swing.border.Border getBorder(java.lang.String key)
           
 javax.swing.UIDefaults getCachedDefaults()
           
 java.awt.Color getColor(java.lang.String key)
           
 java.lang.String getDescription()
           
 java.awt.Font getFont(java.lang.String key)
           
 java.lang.String getID()
           
 java.awt.Insets getInsets(java.lang.String key)
           
static PaletteLookAndFeel getInstance()
           
 java.lang.String getName()
           
(package private) static java.lang.Object getUIOfType(javax.swing.plaf.ComponentUI ui, java.lang.Class klass)
          Returns the ui that is of type klass, or null if one can not be found.
protected  void initComponentDefaults(javax.swing.UIDefaults table)
           
static void installBorder(javax.swing.JComponent c, java.lang.String defaultBorderName)
          Convenience method for installing a component's default Border object on the specified component if either the border is currently null or already an instance of UIResource.
static void installColors(javax.swing.JComponent c, java.lang.String defaultBgName, java.lang.String defaultFgName)
          Convenience method for initializing a component's foreground and background color properties with values from the current defaults table.
static void installColorsAndFont(javax.swing.JComponent c, java.lang.String defaultBgName, java.lang.String defaultFgName, java.lang.String defaultFontName)
          Convenience method for initializing a components foreground background and font properties with values from the current defaults table.
 boolean isNativeLookAndFeel()
           
 boolean isSupportedLookAndFeel()
           
 
Methods inherited from class javax.swing.plaf.basic.BasicLookAndFeel
createAudioAction, getAudioActionMap, getDefaults, initClassDefaults, initialize, initSystemColorDefaults, loadSystemColors, playSound, uninitialize
 
Methods inherited from class javax.swing.LookAndFeel
getDesktopPropertyValue, getDisabledIcon, getDisabledSelectedIcon, getLayoutStyle, getSupportsWindowDecorations, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, provideErrorFeedback, toString, uninstallBorder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

instance

private static PaletteLookAndFeel instance
Shared instance.


cachedDefaults

private javax.swing.UIDefaults cachedDefaults
Cached defaults.

Constructor Detail

PaletteLookAndFeel

public PaletteLookAndFeel()
Method Detail

getInstance

public static PaletteLookAndFeel getInstance()

getName

public java.lang.String getName()
Specified by:
getName in class javax.swing.LookAndFeel

getID

public java.lang.String getID()
Specified by:
getID in class javax.swing.LookAndFeel

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in class javax.swing.LookAndFeel

isNativeLookAndFeel

public boolean isNativeLookAndFeel()
Specified by:
isNativeLookAndFeel in class javax.swing.LookAndFeel

isSupportedLookAndFeel

public boolean isSupportedLookAndFeel()
Specified by:
isSupportedLookAndFeel in class javax.swing.LookAndFeel

getCachedDefaults

public javax.swing.UIDefaults getCachedDefaults()

get

public java.lang.Object get(java.lang.Object key)
Looks up up the given key in our Hashtable and resolves LazyValues or ActiveValues.


getFont

public java.awt.Font getFont(java.lang.String key)

getBorder

public javax.swing.border.Border getBorder(java.lang.String key)

getColor

public java.awt.Color getColor(java.lang.String key)

getInsets

public java.awt.Insets getInsets(java.lang.String key)

getBoolean

public boolean getBoolean(java.lang.String key)

installColorsAndFont

public static void installColorsAndFont(javax.swing.JComponent c,
                                        java.lang.String defaultBgName,
                                        java.lang.String defaultFgName,
                                        java.lang.String defaultFontName)
Convenience method for initializing a components foreground background and font properties with values from the current defaults table. The properties are only set if the current value is either null or a UIResource.

Parameters:
c - the target component for installing default color/font properties
defaultBgName - the key for the default background
defaultFgName - the key for the default foreground
defaultFontName - the key for the default font
See Also:
installColors(javax.swing.JComponent, java.lang.String, java.lang.String), UIManager.getColor(java.lang.Object), UIManager.getFont(java.lang.Object)

installBorder

public static void installBorder(javax.swing.JComponent c,
                                 java.lang.String defaultBorderName)
Convenience method for installing a component's default Border object on the specified component if either the border is currently null or already an instance of UIResource.

Parameters:
c - the target component for installing default border
defaultBorderName - the key specifying the default border

installColors

public static void installColors(javax.swing.JComponent c,
                                 java.lang.String defaultBgName,
                                 java.lang.String defaultFgName)
Convenience method for initializing a component's foreground and background color properties with values from the current defaults table. The properties are only set if the current value is either null or a UIResource.

Parameters:
c - the target component for installing default color/font properties
defaultBgName - the key for the default background
defaultFgName - the key for the default foreground
See Also:
installColorsAndFont(javax.swing.JComponent, java.lang.String, java.lang.String, java.lang.String), UIManager.getColor(java.lang.Object)

initComponentDefaults

protected void initComponentDefaults(javax.swing.UIDefaults table)
Overrides:
initComponentDefaults in class javax.swing.plaf.basic.BasicLookAndFeel

getUIOfType

static java.lang.Object getUIOfType(javax.swing.plaf.ComponentUI ui,
                                    java.lang.Class klass)
Returns the ui that is of type klass, or null if one can not be found.