|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.LookAndFeel javax.swing.plaf.basic.BasicLookAndFeel javax.swing.plaf.metal.MetalLookAndFeel
public class MetalLookAndFeel
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:
swing.boldMetal
to
false
. For example,
java -Dswing.boldMetal=false MyApp
.
swing.boldMetal
to
Boolean.FALSE
. For example:
UIManager.put("swing.boldMetal", Boolean.FALSE);
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 JavaBeansTM
has been added to the java.beans
package.
Please see XMLEncoder
.
Constructor Summary | |
---|---|
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 |
---|
public MetalLookAndFeel()
Method Detail |
---|
public String getName()
LookAndFeel
getName
in class LookAndFeel
public String getID()
LookAndFeel
getID
in class LookAndFeel
public String getDescription()
LookAndFeel
getDescription
in class LookAndFeel
public boolean isNativeLookAndFeel()
LookAndFeel
isNativeLookAndFeel
in class LookAndFeel
public boolean isSupportedLookAndFeel()
LookAndFeel
isSupportedLookAndFeel
in class LookAndFeel
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
public boolean getSupportsWindowDecorations()
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.
getSupportsWindowDecorations
in class LookAndFeel
JDialog.setDefaultLookAndFeelDecorated(boolean)
,
JFrame.setDefaultLookAndFeelDecorated(boolean)
,
JRootPane.setWindowDecorationStyle(int)
protected void initClassDefaults(UIDefaults table)
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".
initClassDefaults
in class BasicLookAndFeel
BasicLookAndFeel.getDefaults()
,
JComponent.getUIClassID()
protected void initSystemColorDefaults(UIDefaults table)
initSystemColorDefaults
in class BasicLookAndFeel
protected void initComponentDefaults(UIDefaults table)
initComponentDefaults
in class BasicLookAndFeel
protected void createDefaultTheme()
public UIDefaults getDefaults()
LookAndFeel
getDefaults
in class BasicLookAndFeel
LookAndFeel.initialize()
,
LookAndFeel.uninitialize()
,
UIManager.setLookAndFeel(javax.swing.LookAndFeel)
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.
provideErrorFeedback
in class LookAndFeel
component
- Component the error occured in, may be
null indicating the error condition is
not directly associated with a
Component
.LookAndFeel.provideErrorFeedback(java.awt.Component)
public static void setCurrentTheme(MetalTheme theme)
MetalLookAndFeel
.
This may not be null.
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);
theme
- the theme to be used, non-null
NullPointerException
- if given a null parametergetCurrentTheme()
public static MetalTheme getCurrentTheme()
MetalLookAndFeel
.
This will always be non-null, as it will set the current theme if one
hasn't been set already.
setCurrentTheme(javax.swing.plaf.metal.MetalTheme)
public Icon getDisabledIcon(JComponent component, Icon icon)
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.
getDisabledIcon
in class LookAndFeel
component
- JComponent that will display the Icon, may be nullicon
- Icon to generate disable icon from.
public Icon getDisabledSelectedIcon(JComponent component, Icon icon)
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.
getDisabledSelectedIcon
in class LookAndFeel
component
- JComponent that will display the Icon, may be nullicon
- Icon to generate disabled and selected icon from.
public static FontUIResource getControlTextFont()
public static FontUIResource getSystemTextFont()
public static FontUIResource getUserTextFont()
public static FontUIResource getMenuTextFont()
public static FontUIResource getWindowTitleFont()
public static FontUIResource getSubTextFont()
public static ColorUIResource getDesktopColor()
public static ColorUIResource getFocusColor()
public static ColorUIResource getWhite()
public static ColorUIResource getBlack()
public static ColorUIResource getControl()
public static ColorUIResource getControlShadow()
public static ColorUIResource getControlDarkShadow()
public static ColorUIResource getControlInfo()
public static ColorUIResource getControlHighlight()
public static ColorUIResource getControlDisabled()
public static ColorUIResource getPrimaryControl()
public static ColorUIResource getPrimaryControlShadow()
public static ColorUIResource getPrimaryControlDarkShadow()
public static ColorUIResource getPrimaryControlInfo()
public static ColorUIResource getPrimaryControlHighlight()
public static ColorUIResource getSystemTextColor()
public static ColorUIResource getControlTextColor()
public static ColorUIResource getInactiveControlTextColor()
public static ColorUIResource getInactiveSystemTextColor()
public static ColorUIResource getUserTextColor()
public static ColorUIResource getTextHighlightColor()
public static ColorUIResource getHighlightedTextColor()
public static ColorUIResource getWindowBackground()
public static ColorUIResource getWindowTitleBackground()
public static ColorUIResource getWindowTitleForeground()
public static ColorUIResource getWindowTitleInactiveBackground()
public static ColorUIResource getWindowTitleInactiveForeground()
public static ColorUIResource getMenuBackground()
public static ColorUIResource getMenuForeground()
public static ColorUIResource getMenuSelectedBackground()
public static ColorUIResource getMenuSelectedForeground()
public static ColorUIResource getMenuDisabledForeground()
public static ColorUIResource getSeparatorBackground()
public static ColorUIResource getSeparatorForeground()
public static ColorUIResource getAcceleratorForeground()
public static ColorUIResource getAcceleratorSelectedForeground()
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.