JavaTM 2 Platform
Std. Ed. v1.4.0

javax.swing.plaf.metal
Class MetalLookAndFeel

java.lang.Object
  |
  +--javax.swing.LookAndFeel
        |
        +--javax.swing.plaf.basic.BasicLookAndFeel
              |
              +--javax.swing.plaf.metal.MetalLookAndFeel
All Implemented Interfaces:
Serializable

public class MetalLookAndFeel
extends BasicLookAndFeel

Implements the Java look and feel (codename: Metal).

For the keyboard keys defined for each component in this look and feel, see Component Keystroke Actions for the Java Look and Feel.

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 JavaBeansTM 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()
           
 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()
           
static ColorUIResource getFocusColor()
           
static ColorUIResource getHighlightedTextColor()
           
 String getID()
          Return a string that identifies this look and feel.
static ColorUIResource getInactiveControlTextColor()
           
static ColorUIResource getInactiveSystemTextColor()
           
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 table)
          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 table)
           
protected  void initSystemColorDefaults(UIDefaults table)
          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 component)
           Invoked when the user attempts an invalid operation, such as pasting into an uneditable JTextField that has focus.
static void setCurrentTheme(MetalTheme theme)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicLookAndFeel
createAudioAction, getAudioActionMap, loadSystemColors, playSound
 
Methods inherited from class javax.swing.LookAndFeel
getDesktopPropertyValue, initialize, installBorder, installColors, installColorsAndFont, loadKeyBindings, makeComponentInputMap, makeIcon, makeInputMap, makeKeyBindings, toString, uninitialize, 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 String getName()
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 String getID()
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 String getDescription()
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 UIDefaults getDefaults()
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.

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:
javax.swing.LookAndFeel#providErrorFeedback

setCurrentTheme

public static void setCurrentTheme(MetalTheme theme)

getControlTextFont

public static FontUIResource getControlTextFont()

getSystemTextFont

public static FontUIResource getSystemTextFont()

getUserTextFont

public static FontUIResource getUserTextFont()

getMenuTextFont

public static FontUIResource getMenuTextFont()

getWindowTitleFont

public static FontUIResource getWindowTitleFont()

getSubTextFont

public static FontUIResource getSubTextFont()

getDesktopColor

public static ColorUIResource getDesktopColor()

getFocusColor

public static ColorUIResource getFocusColor()

getWhite

public static ColorUIResource getWhite()

getBlack

public static ColorUIResource getBlack()

getControl

public static ColorUIResource getControl()

getControlShadow

public static ColorUIResource getControlShadow()

getControlDarkShadow

public static ColorUIResource getControlDarkShadow()

getControlInfo

public static ColorUIResource getControlInfo()

getControlHighlight

public static ColorUIResource getControlHighlight()

getControlDisabled

public static ColorUIResource getControlDisabled()

getPrimaryControl

public static ColorUIResource getPrimaryControl()

getPrimaryControlShadow

public static ColorUIResource getPrimaryControlShadow()

getPrimaryControlDarkShadow

public static ColorUIResource getPrimaryControlDarkShadow()

getPrimaryControlInfo

public static ColorUIResource getPrimaryControlInfo()

getPrimaryControlHighlight

public static ColorUIResource getPrimaryControlHighlight()

getSystemTextColor

public static ColorUIResource getSystemTextColor()

getControlTextColor

public static ColorUIResource getControlTextColor()

getInactiveControlTextColor

public static ColorUIResource getInactiveControlTextColor()

getInactiveSystemTextColor

public static ColorUIResource getInactiveSystemTextColor()

getUserTextColor

public static ColorUIResource getUserTextColor()

getTextHighlightColor

public static ColorUIResource getTextHighlightColor()

getHighlightedTextColor

public static ColorUIResource getHighlightedTextColor()

getWindowBackground

public static ColorUIResource getWindowBackground()

getWindowTitleBackground

public static ColorUIResource getWindowTitleBackground()

getWindowTitleForeground

public static ColorUIResource getWindowTitleForeground()

getWindowTitleInactiveBackground

public static ColorUIResource getWindowTitleInactiveBackground()

getWindowTitleInactiveForeground

public static ColorUIResource getWindowTitleInactiveForeground()

getMenuBackground

public static ColorUIResource getMenuBackground()

getMenuForeground

public static ColorUIResource getMenuForeground()

getMenuSelectedBackground

public static ColorUIResource getMenuSelectedBackground()

getMenuSelectedForeground

public static ColorUIResource getMenuSelectedForeground()

getMenuDisabledForeground

public static ColorUIResource getMenuDisabledForeground()

getSeparatorBackground

public static ColorUIResource getSeparatorBackground()

getSeparatorForeground

public static ColorUIResource getSeparatorForeground()

getAcceleratorForeground

public static ColorUIResource getAcceleratorForeground()

getAcceleratorSelectedForeground

public static ColorUIResource getAcceleratorSelectedForeground()

JavaTM 2 Platform
Std. Ed. v1.4.0

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.