Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
javax.swing.LookAndFeel
javax.swing.plaf.basic.BasicLookAndFeel
javax.swing.plaf.metal.MetalLookAndFeel
public class MetalLookAndFeel
extends BasicLookAndFeel
try { UIManager.setLookAndFeel(new MetalLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); }
Constructor Summary | |
|
Method Summary | |
protected void |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static FontUIResource |
|
static MetalTheme |
|
UIDefaults |
|
String |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
String |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static FontUIResource |
|
String |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static FontUIResource |
|
boolean |
|
static ColorUIResource |
|
static FontUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static FontUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static FontUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
static ColorUIResource |
|
protected void |
|
protected void |
|
protected void |
|
boolean |
|
boolean |
|
static void |
|
Methods inherited from class javax.swing.plaf.basic.BasicLookAndFeel | |
createAudioAction , getAudioActionMap , getDefaults , initClassDefaults , initComponentDefaults , initSystemColorDefaults , initialize , loadSystemColors , playSound , uninitialize |
Methods inherited from class java.lang.Object | |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
protected void createDefaultTheme()
Sets the current theme to a new instance ofDefaultMetalTheme
.
public static ColorUIResource getAcceleratorForeground()
Returns the accelerator foreground color from the installed theme.
- Returns:
- The accelerator foreground color.
public static ColorUIResource getAcceleratorSelectedForeground()
Returns the accelerator selected foreground color from the installed theme.
- Returns:
- The accelerator selected foreground color.
public static ColorUIResource getBlack()
Returns the color black from the installed theme.
- Returns:
- The color black.
public static ColorUIResource getControl()
Returns the control color from the installed theme.
- Returns:
- The control color.
public static ColorUIResource getControlDarkShadow()
Returns the color used for dark shadows on controls, from the installed theme.
- Returns:
- The color used for dark shadows on controls.
public static ColorUIResource getControlDisabled()
Returns the color used for disabled controls, from the installed theme.
- Returns:
- The color used for disabled controls.
public static ColorUIResource getControlHighlight()
Returns the color used to draw highlights for controls, from the installed theme.
- Returns:
- The color used to draw highlights for controls.
public static ColorUIResource getControlInfo()
Returns the color used to display control info, from the installed theme.
- Returns:
- The color used to display control info.
public static ColorUIResource getControlShadow()
Returns the color used to draw shadows for controls, from the installed theme.
- Returns:
- The color used to draw shadows for controls.
public static ColorUIResource getControlTextColor()
Returns the color used for text on controls, from the installed theme.
- Returns:
- The color used for text on controls.
public static FontUIResource getControlTextFont()
Returns the font used for text on controls, from the installed theme.
- Returns:
- The font used for text on controls.
public static MetalTheme getCurrentTheme()
Returns the current theme for the Metal look and feel. The default is an instance ofOceanTheme
.
- Returns:
- The current theme (never
null
).
- See Also:
setCurrentTheme(MetalTheme)
public UIDefaults getDefaults()
Creates and returns a look-and-feel specific defaults table. This method is called once byUIManager.setLookAndFeel(LookAndFeel)
and shouldn't be called again (as it creates a large table of defaults).
- Overrides:
- getDefaults in interface BasicLookAndFeel
- Returns:
- The UI defaults.
public String getDescription()
Returns a string describing the look and feel. In this case, the method returns "Metal look and feel".
- Overrides:
- getDescription in interface LookAndFeel
- Returns:
- A string describing the look and feel.
public static ColorUIResource getDesktopColor()
Returns the color used for the desktop background, from the installed theme.
- Returns:
- The color used for the desktop background.
public static ColorUIResource getFocusColor()
Returns the color used to draw focus highlights, from the installed theme.
- Returns:
- The color used to draw focus highlights.
public static ColorUIResource getHighlightedTextColor()
Returns the color used to draw highlighted text, from the installed theme.
- Returns:
- The color used to draw highlighted text.
public String getID()
Returns the look and feel identifier.
- Overrides:
- getID in interface LookAndFeel
- Returns:
- "MetalLookAndFeel".
public static ColorUIResource getInactiveControlTextColor()
Returns the color used to draw text on inactive controls, from the installed theme.
- Returns:
- The color used to draw text on inactive controls.
public static ColorUIResource getInactiveSystemTextColor()
Returns the color used to draw inactive system text, from the installed theme.
- Returns:
- The color used to draw inactive system text.
public static ColorUIResource getMenuBackground()
Returns the background color for menu items, from the installed theme.
- Returns:
- The background color for menu items.
- See Also:
getMenuSelectedBackground()
public static ColorUIResource getMenuDisabledForeground()
Returns the foreground color for disabled menu items, from the installed theme.
- Returns:
- The foreground color for disabled menu items.
- See Also:
getMenuForeground()
public static ColorUIResource getMenuForeground()
Returns the foreground color for menu items, from the installed theme.
- Returns:
- The foreground color for menu items.
public static ColorUIResource getMenuSelectedBackground()
Returns the background color for selected menu items, from the installed theme.
- Returns:
- The background color for selected menu items.
- See Also:
getMenuBackground()
public static ColorUIResource getMenuSelectedForeground()
Returns the foreground color for selected menu items, from the installed theme.
- Returns:
- The foreground color for selected menu items.
- See Also:
getMenuForeground()
public static FontUIResource getMenuTextFont()
Returns the font used for text in menus, from the installed theme.
- Returns:
- The font used for text in menus.
public String getName()
Returns the look and feel name.
- Overrides:
- getName in interface LookAndFeel
- Returns:
- "MetalLookAndFeel".
public static ColorUIResource getPrimaryControl()
Returns the primary color for controls, from the installed theme.
- Returns:
- The primary color for controls.
public static ColorUIResource getPrimaryControlDarkShadow()
Returns the primary color for the dark shadow on controls, from the installed theme.
- Returns:
- The primary color for the dark shadow on controls.
public static ColorUIResource getPrimaryControlHighlight()
Returns the primary color for the highlight on controls, from the installed theme.
- Returns:
- The primary color for the highlight on controls.
public static ColorUIResource getPrimaryControlInfo()
Returns the primary color for the information on controls, from the installed theme.
- Returns:
- The primary color for the information on controls.
public static ColorUIResource getPrimaryControlShadow()
Returns the primary color for the shadow on controls, from the installed theme.
- Returns:
- The primary color for the shadow on controls.
public static ColorUIResource getSeparatorBackground()
Returns the background color for separators, from the installed theme.
- Returns:
- The background color for separators.
public static ColorUIResource getSeparatorForeground()
Returns the foreground color for separators, from the installed theme.
- Returns:
- The foreground color for separators.
public static FontUIResource getSubTextFont()
Returns the font used for sub text, from the installed theme.
- Returns:
- The font used for sub text.
public boolean getSupportsWindowDecorations()
Returnstrue
because the Metal look and feel supports window decorations for toplevel containers.
- Overrides:
- getSupportsWindowDecorations in interface LookAndFeel
- Returns:
true
public static ColorUIResource getSystemTextColor()
Returns the color used for system text, from the installed theme.
- Returns:
- The color used for system text.
public static FontUIResource getSystemTextFont()
Returns the font used for system text, from the installed theme.
- Returns:
- The font used for system text.
public static ColorUIResource getTextHighlightColor()
Returns the color used to highlight text, from the installed theme.
- Returns:
- The color used to highlight text.
public static ColorUIResource getUserTextColor()
Returns the color used to display user text, from the installed theme.
- Returns:
- The color used to display user text.
public static FontUIResource getUserTextFont()
Returns the font used for user text, obtained from the current theme.
- Returns:
- The font used for user text.
public static ColorUIResource getWhite()
Returns the color used for white, from the installed theme.
- Returns:
- The color used for white.
public static ColorUIResource getWindowBackground()
Returns the window background color, from the installed theme.
- Returns:
- The window background color.
public static ColorUIResource getWindowTitleBackground()
Returns the window title background color, from the installed theme.
- Returns:
- The window title background color.
public static FontUIResource getWindowTitleFont()
Returns the window title font from the current theme.
- Returns:
- The window title font.
- See Also:
MetalTheme
public static ColorUIResource getWindowTitleForeground()
Returns the window title foreground color, from the installed theme.
- Returns:
- The window title foreground color.
public static ColorUIResource getWindowTitleInactiveBackground()
Returns the background color for an inactive window title, from the installed theme.
- Returns:
- The background color for an inactive window title.
public static ColorUIResource getWindowTitleInactiveForeground()
Returns the foreground color for an inactive window title, from the installed theme.
- Returns:
- The foreground color for an inactive window title.
protected void initClassDefaults(UIDefaults defaults)
Sets the ComponentUI classes for all Swing components to the Metal implementations. In particular this sets the following keys:
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
- Overrides:
- initClassDefaults in interface BasicLookAndFeel
- Parameters:
defaults
- the UIDefaults where the class defaults are added
protected void initComponentDefaults(UIDefaults defaults)
Initializes the component defaults for the Metal Look & Feel. In particular this sets the following keys (the colors are given as RGB hex values):
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()
- Overrides:
- initComponentDefaults in interface BasicLookAndFeel
- Parameters:
defaults
- the UIDefaults instance to which the values are added
protected void initSystemColorDefaults(UIDefaults defaults)
Initializes the system color defaults. In particular this sets the following keys:
Key Value Description control 0xcccccc The default color for components
- Overrides:
- initSystemColorDefaults in interface BasicLookAndFeel
public boolean isNativeLookAndFeel()
Returnsfalse
to indicate that this look and feel does not attempt to emulate the look and feel of native applications on the host platform.
- Overrides:
- isNativeLookAndFeel in interface LookAndFeel
- Returns:
false
.
public boolean isSupportedLookAndFeel()
Returnstrue
to indicate that this look and feel is supported on all platforms.
- Overrides:
- isSupportedLookAndFeel in interface LookAndFeel
- Returns:
true
.
public static void setCurrentTheme(MetalTheme theme)
Sets the current theme for the look and feel. Note that the theme must be set before the look and feel is installed. To change the theme for an already running application that is using theMetalLookAndFeel
, first set the theme with this method, then create a new instance ofMetalLookAndFeel
and install it in the usual way (seeUIManager.setLookAndFeel(LookAndFeel)
).
- Parameters:
theme
- the theme (null
not permitted).
- Throws:
NullPointerException
- iftheme
isnull
.
- See Also:
getCurrentTheme()