com.jgoodies.looks.plastic
Class PlasticLookAndFeel

java.lang.Object
  extended by javax.swing.LookAndFeel
      extended by javax.swing.plaf.basic.BasicLookAndFeel
          extended by javax.swing.plaf.metal.MetalLookAndFeel
              extended by com.jgoodies.looks.plastic.PlasticLookAndFeel
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Plastic3DLookAndFeel

public class PlasticLookAndFeel
extends MetalLookAndFeel

The base class for the JGoodies Plastic look&feel family. Initializes class and component defaults for the Plastic L&f and provides keys and optional features for the Plastic family.

Version:
$Revision: 1.21 $
Author:
Karsten Lentzsch
See Also:
Serialized Form

Field Summary
static String BORDER_STYLE_KEY
          Client property key to set a border style - shadows the header style.
static String DEFAULT_THEME_KEY
          A System property key to set the default theme.
static String HIGH_CONTRAST_FOCUS_ENABLED_KEY
          A System property key that indicates that the high contrast focus colors shall be choosen - if applicable.
static String IS_3D_KEY
          Client property key to disable the pseudo 3D effect.
static String TAB_STYLE_DEFAULT_VALUE
          A System property value that indicates that Plastic shall render tabs in the Plastic 1.0 style.
protected static String TAB_STYLE_KEY
          A System property key for the rendering style of the Plastic TabbedPane.
static String TAB_STYLE_METAL_VALUE
          A System property value that indicates that Plastic shall render tabs in the Metal L&F style.
static boolean useHighContrastFocusColors
          Holds whether we are using the high contrast focus colors.
 
Constructor Summary
PlasticLookAndFeel()
          Constructs the PlasticLookAndFeel, creates the default theme and sets it as current Plastic theme.
 
Method Summary
protected  Insets createButtonMargin()
          Creates and returns the margin used by JButton and JToggleButton.
static PlasticTheme createMyDefaultTheme()
          Creates and returns the default color theme.
protected static PlasticTheme createTheme(String themeName)
          Creates and returns a color theme from the specified theme name.
static ColorUIResource getControl()
           
static ColorUIResource getControlDarkShadow()
           
static ColorUIResource getControlHighlight()
           
 String getDescription()
           
static ColorUIResource getFocusColor()
           
static FontPolicy getFontPolicy()
          Looks up and retrieves the FontPolicy used by the JGoodies Plastic Look&Feel family.
static boolean getHighContrastFocusColorsEnabled()
           
 String getID()
           
static List getInstalledThemes()
          Lazily initializes and returns the List of installed color themes.
static BorderUIResource getInternalFrameBorder()
           
static ColorUIResource getMenuItemBackground()
           
static ColorUIResource getMenuItemSelectedBackground()
           
static ColorUIResource getMenuItemSelectedForeground()
           
static PlasticTheme getMyCurrentTheme()
          Deprecated. Replaced by getPlasticTheme().
 String getName()
           
static BorderUIResource getPaletteBorder()
           
static PlasticTheme getPlasticTheme()
          Lazily initializes and returns the PlasticTheme.
static ColorUIResource getPrimaryControl()
           
static ColorUIResource getPrimaryControlDarkShadow()
           
static ColorUIResource getPrimaryControlHighlight()
           
static ColorUIResource getPrimaryControlInfo()
           
static ColorUIResource getPrimaryControlShadow()
           
static ColorUIResource getSimpleInternalFrameBackground()
           
static ColorUIResource getSimpleInternalFrameForeground()
           
static String getTabStyle()
           
static ColorUIResource getTitleTextColor()
           
static FontUIResource getTitleTextFont()
           
static ColorUIResource getWindowTitleBackground()
           
static ColorUIResource getWindowTitleForeground()
           
static ColorUIResource getWindowTitleInactiveBackground()
           
static ColorUIResource getWindowTitleInactiveForeground()
           
protected  void initClassDefaults(UIDefaults table)
          Initializes the class defaults, that is, overrides some UI delegates with JGoodies Plastic implementations.
protected  void initComponentDefaults(UIDefaults table)
           
 void initialize()
          Invoked during UIManager#setLookAndFeel.
protected  void initSystemColorDefaults(UIDefaults table)
          Unlike my superclass I register a unified shadow color.
protected static void installDefaultThemes()
          Install the default color themes.
static void installTheme(PlasticTheme theme)
          Installs a color theme.
protected  boolean is3DEnabled()
           
static void set3DEnabled(boolean b)
           
static void setFontPolicy(FontPolicy fontPolicy)
          Sets the FontPolicy to be used with the JGoodies Plastic L&F family.
static void setHighContrastFocusColorsEnabled(boolean b)
           
static void setMyCurrentTheme(PlasticTheme theme)
          Deprecated. Replaced by setPlasticTheme(PlasticTheme).
static void setPlasticTheme(PlasticTheme theme)
          Sets the theme for colors and fonts used by the Plastic L&F.
static void setTabStyle(String tabStyle)
           
 void uninitialize()
          Invoked during UIManager#setLookAndFeel.
 
Methods inherited from class javax.swing.plaf.metal.MetalLookAndFeel
createDefaultTheme, getAcceleratorForeground, getAcceleratorSelectedForeground, getBlack, getControlDisabled, getControlInfo, getControlShadow, getControlTextColor, getControlTextFont, getCurrentTheme, getDefaults, getDesktopColor, getDisabledIcon, getDisabledSelectedIcon, getHighlightedTextColor, getInactiveControlTextColor, getInactiveSystemTextColor, getMenuBackground, getMenuDisabledForeground, getMenuForeground, getMenuSelectedBackground, getMenuSelectedForeground, getMenuTextFont, getSeparatorBackground, getSeparatorForeground, getSubTextFont, getSupportsWindowDecorations, getSystemTextColor, getSystemTextFont, getTextHighlightColor, getUserTextColor, getUserTextFont, getWhite, getWindowBackground, getWindowTitleFont, isNativeLookAndFeel, isSupportedLookAndFeel, provideErrorFeedback, setCurrentTheme
 
Methods inherited from class javax.swing.plaf.basic.BasicLookAndFeel
createAudioAction, getAudioActionMap, loadSystemColors, playSound
 
Methods inherited from class javax.swing.LookAndFeel
getDesktopPropertyValue, installBorder, installColors, installColorsAndFont, installProperty, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, toString, uninstallBorder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BORDER_STYLE_KEY

public static final String BORDER_STYLE_KEY
Client property key to set a border style - shadows the header style.

See Also:
Constant Field Values

IS_3D_KEY

public static final String IS_3D_KEY
Client property key to disable the pseudo 3D effect.

See Also:
Constant Field Values

DEFAULT_THEME_KEY

public static final String DEFAULT_THEME_KEY
A System property key to set the default theme.

See Also:
Constant Field Values

HIGH_CONTRAST_FOCUS_ENABLED_KEY

public static final String HIGH_CONTRAST_FOCUS_ENABLED_KEY
A System property key that indicates that the high contrast focus colors shall be choosen - if applicable. If not set, some focus colors look good but have low contrast. Basically, the low contrast scheme uses the Plastic colors before 1.0.7, and the high contrast scheme is 1.0.7 - 1.0.9.

See Also:
Constant Field Values

TAB_STYLE_KEY

protected static final String TAB_STYLE_KEY
A System property key for the rendering style of the Plastic TabbedPane. Valid values are: default for the Plastic 1.0 tabs, and metal for the Metal L&F tabs.

See Also:
Constant Field Values

TAB_STYLE_DEFAULT_VALUE

public static final String TAB_STYLE_DEFAULT_VALUE
A System property value that indicates that Plastic shall render tabs in the Plastic 1.0 style. This is the default.

See Also:
Constant Field Values

TAB_STYLE_METAL_VALUE

public static final String TAB_STYLE_METAL_VALUE
A System property value that indicates that Plastic shall render tabs in the Metal L&F style.

See Also:
Constant Field Values

useHighContrastFocusColors

public static boolean useHighContrastFocusColors
Holds whether we are using the high contrast focus colors.

Constructor Detail

PlasticLookAndFeel

public PlasticLookAndFeel()
Constructs the PlasticLookAndFeel, creates the default theme and sets it as current Plastic theme.

Method Detail

getID

public String getID()
Overrides:
getID in class MetalLookAndFeel

getName

public String getName()
Overrides:
getName in class MetalLookAndFeel

getDescription

public String getDescription()
Overrides:
getDescription in class MetalLookAndFeel

getFontPolicy

public static FontPolicy getFontPolicy()
Looks up and retrieves the FontPolicy used by the JGoodies Plastic Look&Feel family. If a FontPolicy has been set, it'll be returned. Otherwise, this method checks if a FontPolicy or FontSet is defined in the system properties or UIDefaults. If so, it is returned. If no FontPolicy has been set for this look, in the system properties or UIDefaults, the default Plastic font policy will be returned.

Returns:
the FontPolicy set for this Look&feel - if any, the FontPolicy specified in the system properties or UIDefaults - if any, or the default Plastic font policy.
See Also:
setFontPolicy(com.jgoodies.looks.FontPolicy), Options.PLASTIC_FONT_POLICY_KEY, FontPolicies, FontPolicies.customSettingsPolicy(FontPolicy), FontPolicies.getDefaultPlasticPolicy()

setFontPolicy

public static void setFontPolicy(FontPolicy fontPolicy)
Sets the FontPolicy to be used with the JGoodies Plastic L&F family. If the specified policy is null, the default will be reset.

Parameters:
fontPolicy - the FontPolicy to be used with the JGoodies Plastic L&F family, or null to reset to the default
See Also:
getFontPolicy(), Options.PLASTIC_FONT_POLICY_KEY

is3DEnabled

protected boolean is3DEnabled()

set3DEnabled

public static void set3DEnabled(boolean b)

getTabStyle

public static String getTabStyle()

setTabStyle

public static void setTabStyle(String tabStyle)

getHighContrastFocusColorsEnabled

public static boolean getHighContrastFocusColorsEnabled()

setHighContrastFocusColorsEnabled

public static void setHighContrastFocusColorsEnabled(boolean b)

initialize

public void initialize()
Invoked during UIManager#setLookAndFeel. In addition to the superclass behavior, we install the ShadowPopupFactory.

Overrides:
initialize in class BasicLookAndFeel
See Also:
uninitialize()

uninitialize

public void uninitialize()
Invoked during UIManager#setLookAndFeel. In addition to the superclass behavior, we uninstall the ShadowPopupFactory.

Overrides:
uninitialize in class BasicLookAndFeel
See Also:
initialize()

initClassDefaults

protected void initClassDefaults(UIDefaults table)
Initializes the class defaults, that is, overrides some UI delegates with JGoodies Plastic implementations.

Overrides:
initClassDefaults in class MetalLookAndFeel
Parameters:
table - the UIDefaults table to work with
See Also:
BasicLookAndFeel.getDefaults()

initComponentDefaults

protected void initComponentDefaults(UIDefaults table)
Overrides:
initComponentDefaults in class MetalLookAndFeel

createButtonMargin

protected Insets createButtonMargin()
Creates and returns the margin used by JButton and JToggleButton. Honors the screen resolution and the global Options.getUseNarrowButtons() property.

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

Returns:
an Insets object that describes the button margin
See Also:
Options.getUseNarrowButtons()

initSystemColorDefaults

protected void initSystemColorDefaults(UIDefaults table)
Unlike my superclass I register a unified shadow color. This color is used by my ThinBevelBorder class.

Overrides:
initSystemColorDefaults in class MetalLookAndFeel
Parameters:
table - the UIDefaults table to work with

createMyDefaultTheme

public static PlasticTheme createMyDefaultTheme()
Creates and returns the default color theme. Honors the current platform and platform flavor - if available.

Returns:
the default color theme for the current environemt

getInstalledThemes

public static List getInstalledThemes()
Lazily initializes and returns the List of installed color themes.

Returns:
a list of installed color/font themes

installDefaultThemes

protected static void installDefaultThemes()
Install the default color themes.


createTheme

protected static PlasticTheme createTheme(String themeName)
Creates and returns a color theme from the specified theme name.

Parameters:
themeName - the unqualified name of the theme to create
Returns:
the associated color theme or null in case of a problem

installTheme

public static void installTheme(PlasticTheme theme)
Installs a color theme.

Parameters:
theme - the theme to install

getPlasticTheme

public static PlasticTheme getPlasticTheme()
Lazily initializes and returns the PlasticTheme. In Java 5 or later, this method looks up the theme using MetalLookAndFeel#getCurrentTheme. In Java 1.4 it is requested from the UIManager. Both access methods use an AppContext to store the theme, so that applets in different contexts don't share the theme.

Returns:
the current PlasticTheme

setPlasticTheme

public static void setPlasticTheme(PlasticTheme theme)
Sets the theme for colors and fonts used by the Plastic L&F.

After setting the theme, you need to re-install the Look&Feel, as well as update the UI's of any previously created components - just as if you'd change the Look&Feel.

Parameters:
theme - the PlasticTheme to be set
Throws:
NullPointerException - if the theme is null.
See Also:
getPlasticTheme()

getMyCurrentTheme

public static PlasticTheme getMyCurrentTheme()
Deprecated. Replaced by getPlasticTheme().

Looks up and returns the PlasticTheme stored in the UIManager.

Returns:
the current PlasticTheme

setMyCurrentTheme

public static void setMyCurrentTheme(PlasticTheme theme)
Deprecated. Replaced by setPlasticTheme(PlasticTheme).

Sets a new PlasticTheme for colors and fonts.

Parameters:
theme - the PlasticTheme to be set

getInternalFrameBorder

public static BorderUIResource getInternalFrameBorder()

getPaletteBorder

public static BorderUIResource getPaletteBorder()

getPrimaryControlDarkShadow

public static ColorUIResource getPrimaryControlDarkShadow()

getPrimaryControlHighlight

public static ColorUIResource getPrimaryControlHighlight()

getPrimaryControlInfo

public static ColorUIResource getPrimaryControlInfo()

getPrimaryControlShadow

public static ColorUIResource getPrimaryControlShadow()

getPrimaryControl

public static ColorUIResource getPrimaryControl()

getControlHighlight

public static ColorUIResource getControlHighlight()

getControlDarkShadow

public static ColorUIResource getControlDarkShadow()

getControl

public static ColorUIResource getControl()

getFocusColor

public static ColorUIResource getFocusColor()

getMenuItemBackground

public static ColorUIResource getMenuItemBackground()

getMenuItemSelectedBackground

public static ColorUIResource getMenuItemSelectedBackground()

getMenuItemSelectedForeground

public static ColorUIResource getMenuItemSelectedForeground()

getWindowTitleBackground

public static ColorUIResource getWindowTitleBackground()

getWindowTitleForeground

public static ColorUIResource getWindowTitleForeground()

getWindowTitleInactiveBackground

public static ColorUIResource getWindowTitleInactiveBackground()

getWindowTitleInactiveForeground

public static ColorUIResource getWindowTitleInactiveForeground()

getSimpleInternalFrameForeground

public static ColorUIResource getSimpleInternalFrameForeground()

getSimpleInternalFrameBackground

public static ColorUIResource getSimpleInternalFrameBackground()

getTitleTextColor

public static ColorUIResource getTitleTextColor()

getTitleTextFont

public static FontUIResource getTitleTextFont()


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