public class MetalLookAndFeel extends javax.swing.plaf.basic.BasicLookAndFeel
try
{
UIManager.setLookAndFeel(new MetalLookAndFeel());
}
catch (UnsupportedLookAndFeelException e)
{
e.printStackTrace();
}| Constructor and Description |
|---|
MetalLookAndFeel()
Creates a new instance of the Metal look and feel.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
createDefaultTheme()
Sets the current theme to a new instance of
DefaultMetalTheme. |
static javax.swing.plaf.ColorUIResource |
getAcceleratorForeground()
Returns the accelerator foreground color from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getAcceleratorSelectedForeground()
Returns the accelerator selected foreground color from the installed
theme.
|
static javax.swing.plaf.ColorUIResource |
getBlack()
Returns the color black from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getControl()
Returns the control color from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getControlDarkShadow()
Returns the color used for dark shadows on controls, from the installed
theme.
|
static javax.swing.plaf.ColorUIResource |
getControlDisabled()
Returns the color used for disabled controls, from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getControlHighlight()
Returns the color used to draw highlights for controls, from the installed
theme.
|
static javax.swing.plaf.ColorUIResource |
getControlInfo()
Returns the color used to display control info, from the installed
theme.
|
static javax.swing.plaf.ColorUIResource |
getControlShadow()
Returns the color used to draw shadows for controls, from the installed
theme.
|
static javax.swing.plaf.ColorUIResource |
getControlTextColor()
Returns the color used for text on controls, from the installed theme.
|
static javax.swing.plaf.FontUIResource |
getControlTextFont()
Returns the font used for text on controls, from the installed theme.
|
static MetalTheme |
getCurrentTheme()
Returns the current theme for the Metal look and feel.
|
javax.swing.UIDefaults |
getDefaults()
Creates and returns a new instance of the default resources for this look
and feel.
|
java.lang.String |
getDescription()
Returns a string describing the look and feel.
|
static javax.swing.plaf.ColorUIResource |
getDesktopColor()
Returns the color used for the desktop background, from the installed
theme.
|
static javax.swing.plaf.ColorUIResource |
getFocusColor()
Returns the color used to draw focus highlights, from the installed
theme.
|
static javax.swing.plaf.ColorUIResource |
getHighlightedTextColor()
Returns the color used to draw highlighted text, from the installed
theme.
|
java.lang.String |
getID()
Returns the look and feel identifier.
|
static javax.swing.plaf.ColorUIResource |
getInactiveControlTextColor()
Returns the color used to draw text on inactive controls, from the
installed theme.
|
static javax.swing.plaf.ColorUIResource |
getInactiveSystemTextColor()
Returns the color used to draw inactive system text, from the installed
theme.
|
static javax.swing.plaf.ColorUIResource |
getMenuBackground()
Returns the background color for menu items, from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getMenuDisabledForeground()
Returns the foreground color for disabled menu items, from the installed
theme.
|
static javax.swing.plaf.ColorUIResource |
getMenuForeground()
Returns the foreground color for menu items, from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getMenuSelectedBackground()
Returns the background color for selected menu items, from the installed
theme.
|
static javax.swing.plaf.ColorUIResource |
getMenuSelectedForeground()
Returns the foreground color for selected menu items, from the installed
theme.
|
static javax.swing.plaf.FontUIResource |
getMenuTextFont()
Returns the font used for text in menus, from the installed theme.
|
java.lang.String |
getName()
Returns the look and feel name.
|
static javax.swing.plaf.ColorUIResource |
getPrimaryControl()
Returns the primary color for controls, from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getPrimaryControlDarkShadow()
Returns the primary color for the dark shadow on controls, from the
installed theme.
|
static javax.swing.plaf.ColorUIResource |
getPrimaryControlHighlight()
Returns the primary color for the highlight on controls, from the
installed theme.
|
static javax.swing.plaf.ColorUIResource |
getPrimaryControlInfo()
Returns the primary color for the information on controls, from the
installed theme.
|
static javax.swing.plaf.ColorUIResource |
getPrimaryControlShadow()
Returns the primary color for the shadow on controls, from the installed
theme.
|
static javax.swing.plaf.ColorUIResource |
getSeparatorBackground()
Returns the background color for separators, from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getSeparatorForeground()
Returns the foreground color for separators, from the installed theme.
|
static javax.swing.plaf.FontUIResource |
getSubTextFont()
Returns the font used for sub text, from the installed theme.
|
boolean |
getSupportsWindowDecorations()
Returns
true because the Metal look
and feel supports window decorations for toplevel
containers. |
static javax.swing.plaf.ColorUIResource |
getSystemTextColor()
Returns the color used for system text, from the installed theme.
|
static javax.swing.plaf.FontUIResource |
getSystemTextFont()
Returns the font used for system text, from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getTextHighlightColor()
Returns the color used to highlight text, from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getUserTextColor()
Returns the color used to display user text, from the installed theme.
|
static javax.swing.plaf.FontUIResource |
getUserTextFont()
Returns the font used for user text, obtained from the current theme.
|
static javax.swing.plaf.ColorUIResource |
getWhite()
Returns the color used for white, from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getWindowBackground()
Returns the window background color, from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getWindowTitleBackground()
Returns the window title background color, from the installed theme.
|
static javax.swing.plaf.FontUIResource |
getWindowTitleFont()
Returns the window title font from the current theme.
|
static javax.swing.plaf.ColorUIResource |
getWindowTitleForeground()
Returns the window title foreground color, from the installed theme.
|
static javax.swing.plaf.ColorUIResource |
getWindowTitleInactiveBackground()
Returns the background color for an inactive window title, from the
installed theme.
|
static javax.swing.plaf.ColorUIResource |
getWindowTitleInactiveForeground()
Returns the foreground color for an inactive window title, from the
installed theme.
|
protected void |
initClassDefaults(javax.swing.UIDefaults defaults)
Sets the ComponentUI classes for all Swing components to the Metal
implementations.
|
protected void |
initComponentDefaults(javax.swing.UIDefaults defaults)
Initializes the component defaults for the Metal Look & Feel.
|
protected void |
initSystemColorDefaults(javax.swing.UIDefaults defaults)
Initializes the system color defaults.
|
boolean |
isNativeLookAndFeel()
Returns
false to indicate that this look and feel does not
attempt to emulate the look and feel of native applications on the host
platform. |
boolean |
isSupportedLookAndFeel()
Returns
true to indicate that this look and feel is supported
on all platforms. |
static void |
setCurrentTheme(MetalTheme theme)
Sets the current theme for the look and feel.
|
createAudioAction, getAudioActionMap, initialize, loadSystemColors, playSound, uninitializepublic MetalLookAndFeel()
protected void createDefaultTheme()
DefaultMetalTheme.public boolean isNativeLookAndFeel()
false to indicate that this look and feel does not
attempt to emulate the look and feel of native applications on the host
platform.isNativeLookAndFeel in class javax.swing.LookAndFeelfalse.public boolean isSupportedLookAndFeel()
true to indicate that this look and feel is supported
on all platforms.isSupportedLookAndFeel in class javax.swing.LookAndFeeltrue.public java.lang.String getDescription()
getDescription in class javax.swing.LookAndFeelpublic java.lang.String getID()
getID in class javax.swing.LookAndFeelpublic java.lang.String getName()
getName in class javax.swing.LookAndFeelpublic javax.swing.UIDefaults getDefaults()
javax.swing.plaf.basic.BasicLookAndFeelgetDefaults in class javax.swing.plaf.basic.BasicLookAndFeelpublic static javax.swing.plaf.ColorUIResource getAcceleratorForeground()
public static javax.swing.plaf.ColorUIResource getAcceleratorSelectedForeground()
public static javax.swing.plaf.ColorUIResource getBlack()
public static javax.swing.plaf.ColorUIResource getControl()
public static javax.swing.plaf.ColorUIResource getControlDarkShadow()
public static javax.swing.plaf.ColorUIResource getControlDisabled()
public static javax.swing.plaf.ColorUIResource getControlHighlight()
public static javax.swing.plaf.ColorUIResource getControlInfo()
public static javax.swing.plaf.ColorUIResource getControlShadow()
public static javax.swing.plaf.ColorUIResource getControlTextColor()
public static javax.swing.plaf.FontUIResource getControlTextFont()
public static javax.swing.plaf.ColorUIResource getDesktopColor()
public static javax.swing.plaf.ColorUIResource getFocusColor()
public static javax.swing.plaf.ColorUIResource getHighlightedTextColor()
public static javax.swing.plaf.ColorUIResource getInactiveControlTextColor()
public static javax.swing.plaf.ColorUIResource getInactiveSystemTextColor()
public static javax.swing.plaf.ColorUIResource getMenuBackground()
getMenuSelectedBackground()public static javax.swing.plaf.ColorUIResource getMenuDisabledForeground()
getMenuForeground()public static javax.swing.plaf.ColorUIResource getMenuForeground()
getMenuDisabledForeground(),
getMenuSelectedForeground()public static javax.swing.plaf.ColorUIResource getMenuSelectedBackground()
getMenuBackground()public static javax.swing.plaf.ColorUIResource getMenuSelectedForeground()
getMenuForeground()public static javax.swing.plaf.FontUIResource getMenuTextFont()
public static javax.swing.plaf.ColorUIResource getPrimaryControl()
public static javax.swing.plaf.ColorUIResource getPrimaryControlDarkShadow()
public static javax.swing.plaf.ColorUIResource getPrimaryControlHighlight()
public static javax.swing.plaf.ColorUIResource getPrimaryControlInfo()
public static javax.swing.plaf.ColorUIResource getPrimaryControlShadow()
public static javax.swing.plaf.ColorUIResource getSeparatorBackground()
public static javax.swing.plaf.ColorUIResource getSeparatorForeground()
public static javax.swing.plaf.FontUIResource getSubTextFont()
public static javax.swing.plaf.ColorUIResource getSystemTextColor()
public static javax.swing.plaf.FontUIResource getSystemTextFont()
public static javax.swing.plaf.ColorUIResource getTextHighlightColor()
public static javax.swing.plaf.ColorUIResource getUserTextColor()
public static javax.swing.plaf.FontUIResource getUserTextFont()
public static javax.swing.plaf.ColorUIResource getWhite()
public static javax.swing.plaf.ColorUIResource getWindowBackground()
public static javax.swing.plaf.ColorUIResource getWindowTitleBackground()
public static javax.swing.plaf.FontUIResource getWindowTitleFont()
MetalThemepublic static javax.swing.plaf.ColorUIResource getWindowTitleForeground()
public static javax.swing.plaf.ColorUIResource getWindowTitleInactiveBackground()
public static javax.swing.plaf.ColorUIResource getWindowTitleInactiveForeground()
public static void setCurrentTheme(MetalTheme theme)
MetalLookAndFeel, first set the theme with this method, then
create a new instance of MetalLookAndFeel and install it in the
usual way (see UIManager.setLookAndFeel(LookAndFeel)).theme - the theme (null not permitted).java.lang.NullPointerException - if theme is null.getCurrentTheme()protected void initClassDefaults(javax.swing.UIDefaults defaults)
| Key | Value |
|---|---|
| ButtonUI | MetalButtonUI |
| CheckBoxUI | MetalCheckBoxUI |
| ComboBoxUI | MetalComboBoxUI |
| DesktopIconUI | MetalDesktopIconUI |
| InternalFrameUI | MetalInternalFrameUI |
| LabelUI | MetalLabelUI |
| PopupMenuSeparatorUI | MetalPopupMenuSeparatorUI |
| ProgressBarUI | MetalProgressBarUI |
| RadioButtonUI | MetalRadioButtonUI |
| RootPaneUI | MetalRootPaneUI |
| ScrollBarUI | MetalScrollBarUI |
| ScrollPaneUI | MetalScrollPaneUI |
| SeparatorUI | MetalSeparatorUI |
| SliderUI | MetalSliderUI |
| SplitPaneUI | MetalSplitPaneUI |
| TabbedPaneUI | MetalTabbedPaneUI |
| TextFieldUI | MetalTextFieldUI |
| ToggleButtonUI | MetalToggleButtonUI |
| ToolBarUI | MetalToolBarUI |
| ToolTipUI | MetalToolTipUI |
| TreeUI | MetalTreeUI |
initClassDefaults in class javax.swing.plaf.basic.BasicLookAndFeeldefaults - the UIDefaults where the class defaults are addedprotected void initComponentDefaults(javax.swing.UIDefaults defaults)
| Key | Value |
|---|---|
| Button.background | 0xcccccc |
| Button.border | MetalBorders.getButtonBorder() |
| Button.font | getControlTextFont() |
| Button.margin | new java.awt.Insets(2, 14, 2, 14)
|
| CheckBox.background | 0xcccccc |
| CheckBoxMenuItem.background | 0xcccccc |
| ToolBar.background | 0xcccccc |
| Panel.background | 0xcccccc |
| Slider.background | 0xcccccc |
| OptionPane.background | 0xcccccc |
| ProgressBar.background | 0xcccccc |
| TabbedPane.background | 0xcccccc |
| Label.background | 0xcccccc |
| Label.font | getControlTextFont() |
| Menu.background | 0xcccccc |
| MenuBar.background | 0xcccccc |
| MenuItem.background | 0xcccccc |
| ScrollBar.background | 0xcccccc |
| PopupMenu.border | new javax.swing.plaf.metal.MetalBorders.PopupMenuBorder() |
initComponentDefaults in class javax.swing.plaf.basic.BasicLookAndFeeldefaults - the UIDefaults instance to which the values are addedprotected void initSystemColorDefaults(javax.swing.UIDefaults defaults)
| Key | Value | Description |
|---|---|---|
| control | 0xcccccc | The default color for components |
initSystemColorDefaults in class javax.swing.plaf.basic.BasicLookAndFeeldefaults - the defaults table (null not permitted).public static MetalTheme getCurrentTheme()
OceanTheme.null).setCurrentTheme(MetalTheme)public boolean getSupportsWindowDecorations()
true because the Metal look
and feel supports window decorations for toplevel
containers.getSupportsWindowDecorations in class javax.swing.LookAndFeeltrue