TopBlend: Here is the first difference. There are 14 differences. is old. is new.


javax.swing.plaf.metal
Class MetalLookAndFeel


java.lang.Object
  extended by javax.swing.LookAndFeel
      extended by javax.swing.plaf.basic.BasicLookAndFeel
          extended by javax.swing.plaf.metal.MetalLookAndFeel
All Implemented Interfaces:
Serializable

public class MetalLookAndFeel
extends BasicLookAndFeel

The Java Look and Feel, otherwise known as Metal. Implements the Java look and feel (codename: Metal).

By default metal uses bold fonts for many controls. To make all controls (with the exception of the internal frame title bars and client decorated frame title bars) use plain fonts you can do either of the following:

The defaults property swing.boldMetal, if set, takes precendence over the system property of the same name. After setting this defaults property you need to re-install the MetalLookAndFeel, as well as update the UI of any previously created widgets. Otherwise the results are undefined. These lines of code show you how to accomplish this:

 // turn off bold fonts
 UIManager.put("swing.boldMetal", Boolean.FALSE);

 // re-install the Metal Look and Feel
 UIManager.setLookAndFeel(new MetalLookAndFeel());

 // only needed to update existing widgets
 SwingUtilities.updateComponentTreeUI(rootComponent);
 

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans TM has been added to the java.beans package. Please see XMLEncoder .


Constructor Summary
MetalLookAndFeel ()
           
 
Method Summary
protected  void createDefaultTheme ()
           
static  ColorUIResource getAcceleratorForeground ()
           
static  ColorUIResource getAcceleratorSelectedForeground ()
           
static  ColorUIResource getBlack ()
           
static  ColorUIResource getControl ()
           
static  ColorUIResource getControlDarkShadow ()
           
static  ColorUIResource getControlDisabled ()
           
static  ColorUIResource getControlHighlight ()
           
static  ColorUIResource getControlInfo ()
           
static  ColorUIResource getControlShadow ()
           
static  ColorUIResource getControlTextColor ()
           
static  FontUIResource getControlTextFont ()
           
static  MetalTheme getCurrentTheme ()
          Return the theme currently being used by MetalLookAndFeel.
  UIDefaults getDefaults ()
          This method is called once by UIManager.setLookAndFeel to create the look and feel specific defaults table.
  String getDescription ()
          Return a one line description of this look and feel implementation, e.g.
static  ColorUIResource getDesktopColor ()
           
  Icon getDisabledIcon ( JComponent  component, Icon
          Returns an Icon with a disabled appearance.
  Icon getDisabledSelectedIcon ( JComponent  component, Icon
          Returns an Icon for use by disabled components that are also selected.
static  ColorUIResource getFocusColor ()
           
static  ColorUIResource getHighlightedTextColor ()
           
  String getID ()
          Return a string that identifies this look and feel.
static  ColorUIResource getInactiveControlTextColor ()
           
static  ColorUIResource getInactiveSystemTextColor ()
           
  LayoutStyle getLayoutStyle ()
          Returns the LayoutStyle for this look and feel.
static  ColorUIResource getMenuBackground ()
           
static  ColorUIResource getMenuDisabledForeground ()
           
static  ColorUIResource getMenuForeground ()
           
static  ColorUIResource getMenuSelectedBackground ()
           
static  ColorUIResource getMenuSelectedForeground ()
           
static  FontUIResource getMenuTextFont ()
           
  String getName ()
          Return a short string that identifies this look and feel, e.g.
static  ColorUIResource getPrimaryControl ()
           
static  ColorUIResource getPrimaryControlDarkShadow ()
           
static  ColorUIResource getPrimaryControlHighlight ()
           
static  ColorUIResource getPrimaryControlInfo ()
           
static  ColorUIResource getPrimaryControlShadow ()
           
static  ColorUIResource getSeparatorBackground ()
           
static  ColorUIResource getSeparatorForeground ()
           
static  FontUIResource getSubTextFont ()
           
 boolean getSupportsWindowDecorations ()
          Returns true if the LookAndFeel returned RootPaneUI instances support providing Window decorations in a JRootPane.
static  ColorUIResource getSystemTextColor ()
           
static  FontUIResource getSystemTextFont ()
           
static  ColorUIResource getTextHighlightColor ()
           
static  ColorUIResource getUserTextColor ()
           
static  FontUIResource getUserTextFont ()
           
static  ColorUIResource getWhite ()
           
static  ColorUIResource getWindowBackground ()
           
static  ColorUIResource getWindowTitleBackground ()
           
static  FontUIResource getWindowTitleFont ()
           
static  ColorUIResource getWindowTitleForeground ()
           
static  ColorUIResource getWindowTitleInactiveBackground ()
           
static  ColorUIResource getWindowTitleInactiveForeground ()
           
protected  void initClassDefaults ( UIDefaults
          Creates the mapping from UI class IDs to ComponentUI classes, putting the ID-ComponentUI pairs in the passed-in defaults table.
protected  void initComponentDefaults ( UIDefaults
           
protected  void initSystemColorDefaults ( UIDefaults
          Load the SystemColors into the defaults table.
 boolean isNativeLookAndFeel ()
          If the underlying platform has a "native" look and feel, and this is an implementation of it, return true.
 boolean isSupportedLookAndFeel ()
          Return true if the underlying platform supports and or permits this look and feel.
 void provideErrorFeedback ( Component
           Invoked when the user attempts an invalid operation, such as pasting into an uneditable JTextField that has focus.
static void setCurrentTheme ( MetalTheme
          Set the theme to be used by MetalLookAndFeel.
 
Methods inherited from class javax.swing.plaf.basic. BasicLookAndFeel
createAudioAction , getAudioActionMap , initialize , loadSystemColors , playSound , uninitialize
 
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
 

Constructor Detail

MetalLookAndFeel


public MetalLookAndFeel () 
Method Detail

getName


public StringgetName () 
Description copied from class: LookAndFeel
Return a short string that identifies this look and feel, e.g. "CDE/Motif". This string should be appropriate for a menu item. Distinct look and feels should have different names, e.g. a subclass of MotifLookAndFeel that changes the way a few components are rendered should be called "CDE/Motif My Way"; something that would be useful to a user trying to select a L&F from a list of names.

Specified by:
getName in class LookAndFeel

getID


public StringgetID () 
Description copied from class: LookAndFeel
Return a string that identifies this look and feel. This string will be used by applications/services that want to recognize well known look and feel implementations. Presently the well known names are "Motif", "Windows", "Mac", "Metal". Note that a LookAndFeel derived from a well known superclass that doesn't make any fundamental changes to the look or feel shouldn't override this method.

Specified by:
getID in class LookAndFeel

getDescription


public StringgetDescription () 
Description copied from class: LookAndFeel
Return a one line description of this look and feel implementation, e.g. "The CDE/Motif Look and Feel". This string is intended for the user, e.g. in the title of a window or in a ToolTip message.

Specified by:
getDescription in class LookAndFeel

isNativeLookAndFeel


public boolean isNativeLookAndFeel () 
Description copied from class: LookAndFeel
If the underlying platform has a "native" look and feel, and this is an implementation of it, return true. For example a CDE/Motif look and implementation would return true when the underlying platform was Solaris.

Specified by:
isNativeLookAndFeel in class LookAndFeel

isSupportedLookAndFeel


public boolean isSupportedLookAndFeel () 
Description copied from class: LookAndFeel
Return true if the underlying platform supports and or permits this look and feel. This method returns false if the look and feel depends on special resources or legal agreements that aren't defined for the current platform.

Specified by:
isSupportedLookAndFeel in class LookAndFeel
See Also:
UIManager.setLookAndFeel(javax.swing.LookAndFeel)

getSupportsWindowDecorations


public boolean getSupportsWindowDecorations () 
Returns true if the LookAndFeel returned RootPaneUI instances support providing Window decorations in a JRootPane.

This implementation returns true, since it does support providing these border and window title pane decorations.

Overrides:
getSupportsWindowDecorations in class LookAndFeel
Returns:
True if the RootPaneUI instances created support client side decorations
Since:
1.4
See Also:
JDialog.setDefaultLookAndFeelDecorated(boolean) , JFrame.setDefaultLookAndFeelDecorated(boolean) , JRootPane.setWindowDecorationStyle(int)

initClassDefaults


protected void initClassDefaults ( UIDefaults table) 
Creates the mapping from UI class IDs to ComponentUI classes, putting the ID-ComponentUI pairs in the passed-in defaults table. Each JComponent class specifies its own UI class ID string. For example, JButton has the UI class ID "ButtonUI", which this method maps to "javax.swing.plaf.metal.MetalButtonUI".

Overrides:
initClassDefaults in class BasicLookAndFeel
See Also:
BasicLookAndFeel.getDefaults() , JComponent.getUIClassID()

initSystemColorDefaults


protected void initSystemColorDefaults ( UIDefaults table) 
Load the SystemColors into the defaults table. The keys for SystemColor defaults are the same as the names of the public fields in SystemColor.

Overrides:
initSystemColorDefaults in class BasicLookAndFeel

initComponentDefaults


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

createDefaultTheme


protected void createDefaultTheme () 

getDefaults


public UIDefaultsgetDefaults () 
Description copied from class: LookAndFeel
This method is called once by UIManager.setLookAndFeel to create the look and feel specific defaults table. Other applications, for example an application builder, may also call this method.

Overrides:
getDefaults in class BasicLookAndFeel
See Also:
LookAndFeel.initialize() , LookAndFeel.uninitialize() , UIManager.setLookAndFeel(javax.swing.LookAndFeel)

provideErrorFeedback


public void provideErrorFeedback ( Component component) 

Invoked when the user attempts an invalid operation, such as pasting into an uneditable JTextField that has focus.

If the user has enabled visual error indication on the desktop, this method will flash the caption bar of the active window. The user can also set the property awt.visualbell=true to achieve the same results.

Each of the ComponentUIs provided by MetalLookAndFeel derives its behavior from the defaults table. Unless otherwise noted each of the ComponentUI implementations in this package document the set of defaults they use. Unless otherwise noted the defaults are installed at the time installUI is invoked, and follow the recommendations outlined in LookAndFeel for installing defaults.

Overrides:
provideErrorFeedback in class LookAndFeel
Parameters:
component - Component the error occured in, may be null indicating the error condition is not directly associated with a Component.
See Also:
LookAndFeel.provideErrorFeedback(java.awt.Component)

setCurrentTheme


public static void setCurrentTheme ( MetalTheme theme) 
Set the theme to be used by MetalLookAndFeel. This may not be null.
After setting the theme, you need to re-install the MetalLookAndFeel, as well as update the UI of any previously created widgets. Otherwise the results are undefined. These lines of code show you how to accomplish this:

 // turn off bold fonts
 MetalLookAndFeel.setCurrentTheme(theme);

 // re-install the Metal Look and Feel
 UIManager.setLookAndFeel(new MetalLookAndFeel());

 // only needed to update existing widgets
 SwingUtilities.updateComponentTreeUI(rootComponent);
 

MetalLookAndFeel derives it's color palette and fonts from MetalTheme. The default theme is OceanTheme. The theme can be changed using the setCurrentTheme method, refer to it for details on changing the theme. Prior to 1.5 the default theme was DefaultMetalTheme. The system property "swing.metalTheme" can be set to "steel" to indicate the default should be DefaultMetalTheme.

Parameters:
theme - the theme to be used, non-null
Throws:
NullPointerException - if given a null parameter
See Also:
getCurrentTheme()

getCurrentTheme


public static MetalThemegetCurrentTheme () 
Return the theme currently being used by MetalLookAndFeel. This will always be non-null, as it will set the current theme if one hasn't been set already.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans TM has been added to the java.beans package. Please see XMLEncoder

Returns:
the current theme
Since:
1.5
See Also:
setCurrentTheme(javax.swing.plaf.metal.MetalTheme) .

getDisabledIcon


public IcongetDisabledIcon ( JComponent component,
 Icon icon) 
Returns an Icon with a disabled appearance. This method is used to generate a disabled Icon when one has not been specified. For example, if you create a JButton and only specify an Icon via setIcon this method will be called to generate the disabled Icon. If null is passed as icon this method returns null.

Some look and feels might not render the disabled Icon, in which case they will ignore this.

See Also: Overrides:
MetalTheme getDisabledIcon , DefaultMetalTheme in class LookAndFeel , OceanTheme
Parameters:
component - JComponent that will display the Icon, may be null
icon - Icon to generate disable icon from.
Returns:
Disabled icon, or null if a suitable Icon can not be generated.
Since:
1.5

getDisabledSelectedIcon


public IcongetDisabledSelectedIcon ( JComponent component,
 Icon icon) 
Returns an Icon for use by disabled components that are also selected. This method is used to generate an Icon for components that are in both the disabled and selected states but do not have a specific Icon for this state. For example, if you create a JButton and only specify an Icon via setIcon this method will be called to generate the disabled and selected Icon. If null is passed as icon this method returns null.

Some look and feels might not render the disabled and selected Icon, in which case they will ignore this.

Overrides:
getDisabledSelectedIcon in class LookAndFeel
Parameters:
component - JComponent that will display the Icon, may be null
icon - Icon to generate disabled and selected icon from.
Returns:
Disabled and Selected icon, or null if a suitable Icon can not be generated.
Since:
1.5

getControlTextFont


public static FontUIResourcegetControlTextFont () 

getSystemTextFont


public static FontUIResourcegetSystemTextFont () 

getUserTextFont


public static FontUIResourcegetUserTextFont () 

getMenuTextFont


public static FontUIResourcegetMenuTextFont () 

getWindowTitleFont


public static FontUIResourcegetWindowTitleFont () 

getSubTextFont


public static FontUIResourcegetSubTextFont () 

getDesktopColor


public static ColorUIResourcegetDesktopColor () 

getFocusColor


public static ColorUIResourcegetFocusColor () 

getWhite


public static ColorUIResourcegetWhite () 

getBlack


public static ColorUIResourcegetBlack () 

getControl


public static ColorUIResourcegetControl () 

getControlShadow


public static ColorUIResourcegetControlShadow () 

getControlDarkShadow


public static ColorUIResourcegetControlDarkShadow () 

getControlInfo


public static ColorUIResourcegetControlInfo () 

getControlHighlight


public static ColorUIResourcegetControlHighlight () 

getControlDisabled


public static ColorUIResourcegetControlDisabled () 

getPrimaryControl


public static ColorUIResourcegetPrimaryControl () 

getPrimaryControlShadow


public static ColorUIResourcegetPrimaryControlShadow () 

getPrimaryControlDarkShadow


public static ColorUIResourcegetPrimaryControlDarkShadow () 

getPrimaryControlInfo


public static ColorUIResourcegetPrimaryControlInfo () 

getPrimaryControlHighlight


public static ColorUIResourcegetPrimaryControlHighlight () 

getSystemTextColor


public static ColorUIResourcegetSystemTextColor () 

getControlTextColor


public static ColorUIResourcegetControlTextColor () 

getInactiveControlTextColor


public static ColorUIResourcegetInactiveControlTextColor () 

getInactiveSystemTextColor


public static ColorUIResourcegetInactiveSystemTextColor () 

getUserTextColor


public static ColorUIResourcegetUserTextColor () 

getTextHighlightColor


public static ColorUIResourcegetTextHighlightColor () 

getHighlightedTextColor


public static ColorUIResourcegetHighlightedTextColor () 

getWindowBackground


public static ColorUIResourcegetWindowBackground () 

getWindowTitleBackground


public static ColorUIResourcegetWindowTitleBackground () 

getWindowTitleForeground


public static ColorUIResourcegetWindowTitleForeground () 

getWindowTitleInactiveBackground


public static ColorUIResourcegetWindowTitleInactiveBackground () 

getWindowTitleInactiveForeground


public static ColorUIResourcegetWindowTitleInactiveForeground () 

getMenuBackground


public static ColorUIResourcegetMenuBackground () 

getMenuForeground


public static ColorUIResourcegetMenuForeground () 

getMenuSelectedBackground


public static ColorUIResourcegetMenuSelectedBackground () 

getMenuSelectedForeground


public static ColorUIResourcegetMenuSelectedForeground () 

getMenuDisabledForeground


public static ColorUIResourcegetMenuDisabledForeground () 

getSeparatorBackground


public static ColorUIResourcegetSeparatorBackground () 

getSeparatorForeground


public static ColorUIResourcegetSeparatorForeground () 

getAcceleratorForeground


public static ColorUIResourcegetAcceleratorForeground () 

getAcceleratorSelectedForeground


public static ColorUIResourcegetAcceleratorSelectedForeground () 

getLayoutStyle


public LayoutStylegetLayoutStyle () 
Returns the LayoutStyle for this look and feel. This will never return null.

You generally don't use the LayoutStyle from the look and feel, instead use the LayoutStyle method getInstance.

Overrides:
getLayoutStyle in class LookAndFeel
Returns:
the LayoutStyle for this look and feel
See Also:
LayoutStyle.getInstance()

Constructor Summary
MetalLookAndFeel ()
           
 
Method Summary
protected  void createDefaultTheme ()
          Ensures the current MetalTheme is non-null.
static  ColorUIResource getAcceleratorForeground ()
          Returns the accelerator foreground color of the current theme.
static  ColorUIResource getAcceleratorSelectedForeground ()
          Returns the accelerator selected foreground color of the current theme.
static  ColorUIResource getBlack ()
          Returns the black color of the current theme.
static  ColorUIResource getControl ()
          Returns the control color of the current theme.
static  ColorUIResource getControlDarkShadow ()
          Returns the control dark shadow color of the current theme.
static  ColorUIResource getControlDisabled ()
          Returns the control disabled color of the current theme.
static  ColorUIResource getControlHighlight ()
          Returns the control highlight color of the current theme.
static  ColorUIResource getControlInfo ()
          Returns the control info color of the current theme.
static  ColorUIResource getControlShadow ()
          Returns the control shadow color of the current theme.
static  ColorUIResource getControlTextColor ()
          Returns the control text color of the current theme.
static  FontUIResource getControlTextFont ()
          Returns the control text font of the current theme.
static  MetalTheme getCurrentTheme ()
          Return the theme currently being used by MetalLookAndFeel.
  UIDefaults getDefaults ()
          Returns the look and feel defaults.
  String getDescription ()
          Returns a short description of this look and feel.
static  ColorUIResource getDesktopColor ()
          Returns the desktop color of the current theme.
  Icon getDisabledIcon ( JComponent  component, Icon
          Returns an Icon with a disabled appearance.
  Icon getDisabledSelectedIcon ( JComponent  component, Icon
          Returns an Icon for use by disabled components that are also selected.
static  ColorUIResource getFocusColor ()
          Returns the focus color of the current theme.
static  ColorUIResource getHighlightedTextColor ()
          Returns the highlighted text color of the current theme.
  String getID ()
          Returns an identifier for this look and feel.
static  ColorUIResource getInactiveControlTextColor ()
          Returns the inactive control text color of the current theme.
static  ColorUIResource getInactiveSystemTextColor ()
          Returns the inactive system text color of the current theme.
  LayoutStyle getLayoutStyle ()
          Returns a LayoutStyle implementing the Java look and feel design guidelines as specified at http://java.sun.com/products/jlf/ed2/book/HIG.Visual2.html
static  ColorUIResource getMenuBackground ()
          Returns the menu background color of the current theme.
static  ColorUIResource getMenuDisabledForeground ()
          Returns the menu disabled foreground color of the current theme.
static  ColorUIResource getMenuForeground ()
          Returns the menu foreground color of the current theme.
static  ColorUIResource getMenuSelectedBackground ()
          Returns the menu selected background color of the current theme.
static  ColorUIResource getMenuSelectedForeground ()
          Returns the menu selected foreground color of the current theme.
static  FontUIResource getMenuTextFont ()
          Returns the menu text font of the current theme.
  String getName ()
          Returns the name of this look and feel.
static  ColorUIResource getPrimaryControl ()
          Returns the primary control color of the current theme.
static  ColorUIResource getPrimaryControlDarkShadow ()
          Returns the primary control dark shadow color of the current theme.
static  ColorUIResource getPrimaryControlHighlight ()
          Returns the primary control highlight color of the current theme.
static  ColorUIResource getPrimaryControlInfo ()
          Returns the primary control info color of the current theme.
static  ColorUIResource getPrimaryControlShadow ()
          Returns the primary control shadow color of the current theme.
static  ColorUIResource getSeparatorBackground ()
          Returns the separator background color of the current theme.
static  ColorUIResource getSeparatorForeground ()
          Returns the separator foreground color of the current theme.
static  FontUIResource getSubTextFont ()
          Returns the sub-text font of the current theme.
 boolean getSupportsWindowDecorations ()
          Returns true; metal can provide Window decorations.
static  ColorUIResource getSystemTextColor ()
          Returns the system text color of the current theme.
static  FontUIResource getSystemTextFont ()
          Returns the sytem text font of the current theme.
static  ColorUIResource getTextHighlightColor ()
          Returns the text highlight color of the current theme.
static  ColorUIResource getUserTextColor ()
          Returns the user text color of the current theme.
static  FontUIResource getUserTextFont ()
          Returns the user text font of the current theme.
static  ColorUIResource getWhite ()
          Returns the white color of the current theme.
static  ColorUIResource getWindowBackground ()
          Returns the window background color of the current theme.
static  ColorUIResource getWindowTitleBackground ()
          Returns the window title background color of the current theme.
static  FontUIResource getWindowTitleFont ()
          Returns the window title font of the current theme.
static  ColorUIResource getWindowTitleForeground ()
          Returns the window title foreground color of the current theme.
static  ColorUIResource getWindowTitleInactiveBackground ()
          Returns the window title inactive background color of the current theme.
static  ColorUIResource getWindowTitleInactiveForeground ()
          Returns the window title inactive foreground color of the current theme.
protected  void initClassDefaults ( UIDefaults
          Populates table with mappings from uiClassID to the fully qualified name of the ui class.
protected  void initComponentDefaults ( UIDefaults
          Populates table with the defaults for metal.
protected  void initSystemColorDefaults ( UIDefaults
          Populates table with system colors.
 boolean isNativeLookAndFeel ()
          Returns false; MetalLookAndFeel is not a native look and feel.
 boolean isSupportedLookAndFeel ()
          Returns true; MetalLookAndFeel can be run on any platform.
 void provideErrorFeedback ( Component
          Invoked when the user attempts an invalid operation, such as pasting into an uneditable JTextField that has focus.
static void setCurrentTheme ( MetalTheme
          Set the theme used by MetalLookAndFeel.
 
Methods inherited from class javax.swing.plaf.basic. BasicLookAndFeel
createAudioAction , getAudioActionMap , initialize , loadSystemColors , playSound , uninitialize
 
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
 

Constructor Detail

MetalLookAndFeel


 
public MetalLookAndFeel () 
Method Detail

getName


 
public StringgetName () 
Returns the name of this look and feel. This returns "Metal".

Specified by:
getName in class LookAndFeel
Returns:
the name of this look and feel

getID


 
public StringgetID () 
Returns an identifier for this look and feel. This returns "Metal".

Specified by:
getID in class LookAndFeel
Returns:
the identifier of this look and feel

getDescription


 
public StringgetDescription () 
Returns a short description of this look and feel. This returns "The Java(tm) Look and Feel".

Specified by:
getDescription in class LookAndFeel
Returns:
a short description for the look and feel

isNativeLookAndFeel


 
public boolean isNativeLookAndFeel () 
Returns false; MetalLookAndFeel is not a native look and feel.

Specified by:
isNativeLookAndFeel in class LookAndFeel
Returns:
false

isSupportedLookAndFeel


 
public boolean isSupportedLookAndFeel () 
Returns true; MetalLookAndFeel can be run on any platform.

Specified by:
isSupportedLookAndFeel in class LookAndFeel
Returns:
true
See Also:
UIManager.setLookAndFeel(javax.swing.LookAndFeel)

getSupportsWindowDecorations


 
public boolean getSupportsWindowDecorations () 
Returns true; metal can provide Window decorations.

Overrides:
getSupportsWindowDecorations in class LookAndFeel
Returns:
true
Since:
1.4
See Also:
JDialog.setDefaultLookAndFeelDecorated(boolean) , JFrame.setDefaultLookAndFeelDecorated(boolean) , JRootPane.setWindowDecorationStyle(int)

initClassDefaults


 
protected void initClassDefaults ( UIDefaults table) 
Populates table with mappings from uiClassID to the fully qualified name of the ui class. MetalLookAndFeel registers an entry for each of the classes in the package javax.swing.plaf.metal that are named MetalXXXUI. The string XXX is one of Swing's uiClassIDs. For the uiClassIDs that do not have a class in metal, the corresponding class in javax.swing.plaf.basic is used. For example, metal does not have a class named "MetalColorChooserUI", as such, javax.swing.plaf.basic.BasicColorChooserUI is used.

Overrides:
initClassDefaults in class BasicLookAndFeel
Parameters:
table - the UIDefaults instance the entries are added to
Throws:
NullPointerException - if table is null
See Also:
BasicLookAndFeel.initClassDefaults(javax.swing.UIDefaults)

initSystemColorDefaults


 
protected void initSystemColorDefaults ( UIDefaults table) 
Populates table with system colors. The following values are added to table:
Key Value
"desktop" theme.getDesktopColor()
"activeCaption" theme.getWindowTitleBackground()
"activeCaptionText" theme.getWindowTitleForeground()
"activeCaptionBorder" theme.getPrimaryControlShadow()
"inactiveCaption" theme.getWindowTitleInactiveBackground()
"inactiveCaptionText" theme.getWindowTitleInactiveForeground()
"inactiveCaptionBorder" theme.getControlShadow()
"window" theme.getWindowBackground()
"windowBorder" theme.getControl()
"windowText" theme.getUserTextColor()
"menu" theme.getMenuBackground()
"menuText" theme.getMenuForeground()
"text" theme.getWindowBackground()
"textText" theme.getUserTextColor()
"textHighlight" theme.getTextHighlightColor()
"textHighlightText" theme.getHighlightedTextColor()
"textInactiveText" theme.getInactiveSystemTextColor()
"control" theme.getControl()
"controlText" theme.getControlTextColor()
"controlHighlight" theme.getControlHighlight()
"controlLtHighlight" theme.getControlHighlight()
"controlShadow" theme.getControlShadow()
"controlDkShadow" theme.getControlDarkShadow()
"scrollbar" theme.getControl()
"info" theme.getPrimaryControl()
"infoText" theme.getPrimaryControlInfo()
The value theme corresponds to the current MetalTheme.

Overrides:
initSystemColorDefaults in class BasicLookAndFeel
Parameters:
table - the UIDefaults object the values are added to
Throws:
NullPointerException - if table is null
See Also:
SystemColor , BasicLookAndFeel.getDefaults() , BasicLookAndFeel.loadSystemColors(javax.swing.UIDefaults, java.lang.String[], boolean)

initComponentDefaults


 
protected void initComponentDefaults ( UIDefaults table) 
Populates table with the defaults for metal.

Overrides:
initComponentDefaults in class BasicLookAndFeel
Parameters:
table - the UIDefaults to add the values to
Throws:
NullPointerException - if table is null

createDefaultTheme


 
protected void createDefaultTheme () 
Ensures the current MetalTheme is non-null. This is a cover method for getCurrentTheme.

See Also:
getCurrentTheme()

getDefaults


 
public UIDefaultsgetDefaults () 
Returns the look and feel defaults. This invokes, in order, createDefaultTheme(), super.getDefaults() and getCurrentTheme().addCustomEntriesToTable(table).

While this method is public, it should only be invoked by the UIManager when the look and feel is set as the current look and feel and after initialize has been invoked.

Overrides:
getDefaults in class BasicLookAndFeel
Returns:
the look and feel defaults
See Also:
createDefaultTheme() , BasicLookAndFeel.getDefaults() , MetalTheme.addCustomEntriesToTable(UIDefaults)

provideErrorFeedback


 
public void provideErrorFeedback ( Component component) 
Invoked when the user attempts an invalid operation, such as pasting into an uneditable JTextField that has focus. The default implementation beeps. Subclasses that wish different behavior should override this and provide the additional feedback.

Overrides:
provideErrorFeedback in class LookAndFeel
Parameters:
component - the Component the error occurred in, may be null indicating the error condition is not directly associated with a Component
Since:
1.4

setCurrentTheme


 
public static void setCurrentTheme ( MetalTheme theme) 
Set the theme used by MetalLookAndFeel.

After the theme is set, MetalLookAndFeel needs to be re-installed and the uis need to be recreated. The following shows how to do this:


 MetalLookAndFeel.setCurrentTheme(theme);

 // re-install the Metal Look and Feel
 UIManager.setLookAndFeel(new MetalLookAndFeel());

 // Update the ComponentUIs for all Components. This
 // needs to be invoked for all windows.
 SwingUtilities.updateComponentTreeUI(rootComponent);
 
If this is not done the results are undefined.

Parameters:
theme - the theme to use
Throws:
NullPointerException - if theme is null
See Also:
getCurrentTheme()

getCurrentTheme


 
public static MetalThemegetCurrentTheme () 
Return the theme currently being used by MetalLookAndFeel. If the current theme is null, the default theme is created.

Returns:
the current theme
Since:
1.5
See Also:
setCurrentTheme(javax.swing.plaf.metal.MetalTheme)

getDisabledIcon


 
public IcongetDisabledIcon ( JComponent component,
 Icon icon) 
Returns an Icon with a disabled appearance. This method is used to generate a disabled Icon when one has not been specified. For example, if you create a JButton and only specify an Icon via setIcon this method will be called to generate the disabled Icon. If null is passed as icon this method returns null.

Some look and feels might not render the disabled Icon, in which case they will ignore this.

Overrides:
getDisabledIcon in class LookAndFeel
Parameters:
component - JComponent that will display the Icon, may be null
icon - Icon to generate disable icon from.
Returns:
Disabled icon, or null if a suitable Icon can not be generated.
Since:
1.5

getDisabledSelectedIcon


 
public IcongetDisabledSelectedIcon ( JComponent component,
 Icon icon) 
Returns an Icon for use by disabled components that are also selected. This method is used to generate an Icon for components that are in both the disabled and selected states but do not have a specific Icon for this state. For example, if you create a JButton and only specify an Icon via setIcon this method will be called to generate the disabled and selected Icon. If null is passed as icon this method returns null.

Some look and feels might not render the disabled and selected Icon, in which case they will ignore this.

Overrides:
getDisabledSelectedIcon in class LookAndFeel
Parameters:
component - JComponent that will display the Icon, may be null
icon - Icon to generate disabled and selected icon from.
Returns:
Disabled and Selected icon, or null if a suitable Icon can not be generated.
Since:
1.5

getControlTextFont


 
public static FontUIResourcegetControlTextFont () 
Returns the control text font of the current theme. This is a cover method for getCurrentTheme().getControlTextColor().

Returns:
the control text font
See Also:
MetalTheme

getSystemTextFont


 
public static FontUIResourcegetSystemTextFont () 
Returns the sytem text font of the current theme. This is a cover method for getCurrentTheme().getSystemTextFont().

Returns:
the system text font
See Also:
MetalTheme

getUserTextFont


 
public static FontUIResourcegetUserTextFont () 
Returns the user text font of the current theme. This is a cover method for getCurrentTheme().getUserTextFont().

Returns:
the user text font
See Also:
MetalTheme

getMenuTextFont


 
public static FontUIResourcegetMenuTextFont () 
Returns the menu text font of the current theme. This is a cover method for getCurrentTheme().getMenuTextFont().

Returns:
the menu text font
See Also:
MetalTheme

getWindowTitleFont


 
public static FontUIResourcegetWindowTitleFont () 
Returns the window title font of the current theme. This is a cover method for getCurrentTheme().getWindowTitleFont().

Returns:
the window title font
See Also:
MetalTheme

getSubTextFont


 
public static FontUIResourcegetSubTextFont () 
Returns the sub-text font of the current theme. This is a cover method for getCurrentTheme().getSubTextFont().

Returns:
the sub-text font
See Also:
MetalTheme

getDesktopColor


 
public static ColorUIResourcegetDesktopColor () 
Returns the desktop color of the current theme. This is a cover method for getCurrentTheme().getDesktopColor().

Returns:
the desktop color
See Also:
MetalTheme

getFocusColor


 
public static ColorUIResourcegetFocusColor () 
Returns the focus color of the current theme. This is a cover method for getCurrentTheme().getFocusColor().

Returns:
the focus color
See Also:
MetalTheme

getWhite


 
public static ColorUIResourcegetWhite () 
Returns the white color of the current theme. This is a cover method for getCurrentTheme().getWhite().

Returns:
the white color
See Also:
MetalTheme

getBlack


 
public static ColorUIResourcegetBlack () 
Returns the black color of the current theme. This is a cover method for getCurrentTheme().getBlack().

Returns:
the black color
See Also:
MetalTheme

getControl


 
public static ColorUIResourcegetControl () 
Returns the control color of the current theme. This is a cover method for getCurrentTheme().getControl().

Returns:
the control color
See Also:
MetalTheme

getControlShadow


 
public static ColorUIResourcegetControlShadow () 
Returns the control shadow color of the current theme. This is a cover method for getCurrentTheme().getControlShadow().

Returns:
the control shadow color
See Also:
MetalTheme

getControlDarkShadow


 
public static ColorUIResourcegetControlDarkShadow () 
Returns the control dark shadow color of the current theme. This is a cover method for getCurrentTheme().getControlDarkShadow().

Returns:
the control dark shadow color
See Also:
MetalTheme

getControlInfo


 
public static ColorUIResourcegetControlInfo () 
Returns the control info color of the current theme. This is a cover method for getCurrentTheme().getControlInfo().

Returns:
the control info color
See Also:
MetalTheme

getControlHighlight


 
public static ColorUIResourcegetControlHighlight () 
Returns the control highlight color of the current theme. This is a cover method for getCurrentTheme().getControlHighlight().

Returns:
the control highlight color
See Also:
MetalTheme

getControlDisabled


 
public static ColorUIResourcegetControlDisabled () 
Returns the control disabled color of the current theme. This is a cover method for getCurrentTheme().getControlDisabled().

Returns:
the control disabled color
See Also:
MetalTheme

getPrimaryControl


 
public static ColorUIResourcegetPrimaryControl () 
Returns the primary control color of the current theme. This is a cover method for getCurrentTheme().getPrimaryControl().

Returns:
the primary control color
See Also:
MetalTheme

getPrimaryControlShadow


 
public static ColorUIResourcegetPrimaryControlShadow () 
Returns the primary control shadow color of the current theme. This is a cover method for getCurrentTheme().getPrimaryControlShadow().

Returns:
the primary control shadow color
See Also:
MetalTheme

getPrimaryControlDarkShadow


 
public static ColorUIResourcegetPrimaryControlDarkShadow () 
Returns the primary control dark shadow color of the current theme. This is a cover method for getCurrentTheme().getPrimaryControlDarkShadow().

Returns:
the primary control dark shadow color
See Also:
MetalTheme

getPrimaryControlInfo


 
public static ColorUIResourcegetPrimaryControlInfo () 
Returns the primary control info color of the current theme. This is a cover method for getCurrentTheme().getPrimaryControlInfo().

Returns:
the primary control info color
See Also:
MetalTheme

getPrimaryControlHighlight


 
public static ColorUIResourcegetPrimaryControlHighlight () 
Returns the primary control highlight color of the current theme. This is a cover method for getCurrentTheme().getPrimaryControlHighlight().

Returns:
the primary control highlight color
See Also:
MetalTheme

getSystemTextColor


 
public static ColorUIResourcegetSystemTextColor () 
Returns the system text color of the current theme. This is a cover method for getCurrentTheme().getSystemTextColor().

Returns:
the system text color
See Also:
MetalTheme

getControlTextColor


 
public static ColorUIResourcegetControlTextColor () 
Returns the control text color of the current theme. This is a cover method for getCurrentTheme().getControlTextColor().

Returns:
the control text color
See Also:
MetalTheme

getInactiveControlTextColor


 
public static ColorUIResourcegetInactiveControlTextColor () 
Returns the inactive control text color of the current theme. This is a cover method for getCurrentTheme().getInactiveControlTextColor().

Returns:
the inactive control text color
See Also:
MetalTheme

getInactiveSystemTextColor


 
public static ColorUIResourcegetInactiveSystemTextColor () 
Returns the inactive system text color of the current theme. This is a cover method for getCurrentTheme().getInactiveSystemTextColor().

Returns:
the inactive system text color
See Also:
MetalTheme

getUserTextColor


 
public static ColorUIResourcegetUserTextColor () 
Returns the user text color of the current theme. This is a cover method for getCurrentTheme().getUserTextColor().

Returns:
the user text color
See Also:
MetalTheme

getTextHighlightColor


 
public static ColorUIResourcegetTextHighlightColor () 
Returns the text highlight color of the current theme. This is a cover method for getCurrentTheme().getTextHighlightColor().

Returns:
the text highlight color
See Also:
MetalTheme

getHighlightedTextColor


 
public static ColorUIResourcegetHighlightedTextColor () 
Returns the highlighted text color of the current theme. This is a cover method for getCurrentTheme().getHighlightedTextColor().

Returns:
the highlighted text color
See Also:
MetalTheme

getWindowBackground


 
public static ColorUIResourcegetWindowBackground () 
Returns the window background color of the current theme. This is a cover method for getCurrentTheme().getWindowBackground().

Returns:
the window background color
See Also:
MetalTheme

getWindowTitleBackground


 
public static ColorUIResourcegetWindowTitleBackground () 
Returns the window title background color of the current theme. This is a cover method for getCurrentTheme().getWindowTitleBackground().

Returns:
the window title background color
See Also:
MetalTheme

getWindowTitleForeground


 
public static ColorUIResourcegetWindowTitleForeground () 
Returns the window title foreground color of the current theme. This is a cover method for getCurrentTheme().getWindowTitleForeground().

Returns:
the window title foreground color
See Also:
MetalTheme

getWindowTitleInactiveBackground


 
public static ColorUIResourcegetWindowTitleInactiveBackground () 
Returns the window title inactive background color of the current theme. This is a cover method for getCurrentTheme().getWindowTitleInactiveBackground().

Returns:
the window title inactive background color
See Also:
MetalTheme

getWindowTitleInactiveForeground


 
public static ColorUIResourcegetWindowTitleInactiveForeground () 
Returns the window title inactive foreground color of the current theme. This is a cover method for getCurrentTheme().getWindowTitleInactiveForeground().

Returns:
the window title inactive foreground color
See Also:
MetalTheme

getMenuBackground


 
public static ColorUIResourcegetMenuBackground () 
Returns the menu background color of the current theme. This is a cover method for getCurrentTheme().getMenuBackground().

Returns:
the menu background color
See Also:
MetalTheme

getMenuForeground


 
public static ColorUIResourcegetMenuForeground () 
Returns the menu foreground color of the current theme. This is a cover method for getCurrentTheme().getMenuForeground().

Returns:
the menu foreground color
See Also:
MetalTheme

getMenuSelectedBackground


 
public static ColorUIResourcegetMenuSelectedBackground () 
Returns the menu selected background color of the current theme. This is a cover method for getCurrentTheme().getMenuSelectedBackground().

Returns:
the menu selected background color
See Also:
MetalTheme

getMenuSelectedForeground


 
public static ColorUIResourcegetMenuSelectedForeground () 
Returns the menu selected foreground color of the current theme. This is a cover method for getCurrentTheme().getMenuSelectedForeground().

Returns:
the menu selected foreground color
See Also:
MetalTheme

getMenuDisabledForeground


 
public static ColorUIResourcegetMenuDisabledForeground () 
Returns the menu disabled foreground color of the current theme. This is a cover method for getCurrentTheme().getMenuDisabledForeground().

Returns:
the menu disabled foreground color
See Also:
MetalTheme

getSeparatorBackground


 
public static ColorUIResourcegetSeparatorBackground () 
Returns the separator background color of the current theme. This is a cover method for getCurrentTheme().getSeparatorBackground().

Returns:
the separator background color
See Also:
MetalTheme

getSeparatorForeground


 
public static ColorUIResourcegetSeparatorForeground () 
Returns the separator foreground color of the current theme. This is a cover method for getCurrentTheme().getSeparatorForeground().

Returns:
the separator foreground color
See Also:
MetalTheme

getAcceleratorForeground


 
public static ColorUIResourcegetAcceleratorForeground () 
Returns the accelerator foreground color of the current theme. This is a cover method for getCurrentTheme().getAcceleratorForeground().

Returns:
the separator accelerator foreground color
See Also:
MetalTheme

getAcceleratorSelectedForeground


 
public static ColorUIResourcegetAcceleratorSelectedForeground () 
Returns the accelerator selected foreground color of the current theme. This is a cover method for getCurrentTheme().getAcceleratorSelectedForeground().

Returns:
the accelerator selected foreground color
See Also:
MetalTheme

getLayoutStyle


 
public LayoutStylegetLayoutStyle () 
Returns a LayoutStyle implementing the Java look and feel design guidelines as specified at http://java.sun.com/products/jlf/ed2/book/HIG.Visual2.html .

Overrides:
getLayoutStyle in class LookAndFeel
Returns:
LayoutStyle implementing the Java look and feel design guidelines
Since:
1.6
See Also:
LayoutStyle.getInstance()