/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* The Java Look and Feel, otherwise known as Metal.
* <p>
* Each of the {@code ComponentUI}s provided by {@code
* MetalLookAndFeel} derives its behavior from the defaults
* table. Unless otherwise noted each of the {@code ComponentUI}
* implementations in this package document the set of defaults they
* use. Unless otherwise noted the defaults are installed at the time
* {@code installUI} is invoked, and follow the recommendations
* outlined in {@code LookAndFeel} for installing defaults.
* <p>
* {@code MetalLookAndFeel} derives it's color palette and fonts from
* {@code MetalTheme}. The default theme is {@code OceanTheme}. The theme
* can be changed using the {@code setCurrentTheme} method, refer to it
* for details on changing the theme. Prior to 1.5 the default
* theme was {@code DefaultMetalTheme}. The system property
* {@code "swing.metalTheme"} can be set to {@code "steel"} to indicate
* the default should be {@code DefaultMetalTheme}.
* <p>
* <strong>Warning:</strong>
* 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<sup><font size="-2">TM</font></sup>
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see MetalTheme
* @see DefaultMetalTheme
* @see OceanTheme
*
* @author Steve Wilson
*/
{
private static boolean METAL_LOOK_AND_FEEL_INITED = false;
/**
* True if checked for windows yet.
*/
private static boolean checkedWindows;
/**
* True if running on Windows.
*/
private static boolean isWindows;
/**
* Set to true first time we've checked swing.useSystemFontSettings.
*/
private static boolean checkedSystemFontSettings;
/**
* True indicates we should use system fonts, unless the developer has
* specified otherwise with Application.useSystemFontSettings.
*/
private static boolean useSystemFonts;
/**
* Returns true if running on Windows.
*/
static boolean isWindows() {
if (!checkedWindows) {
isWindows = true;
new GetPropertyAction("swing.useSystemFontSettings"));
}
checkedWindows = true;
}
return isWindows;
}
/**
* Returns true if system fonts should be used, this is only useful
* for windows.
*/
static boolean useSystemFonts() {
if (isWindows() && useSystemFonts) {
if (METAL_LOOK_AND_FEEL_INITED) {
"Application.useSystemFontSettings");
}
// If an instanceof MetalLookAndFeel hasn't been inited yet, we
// don't want to trigger loading of a UI by asking the UIManager
// for a property, assume the user wants system fonts. This will
// be properly adjusted when install is invoked on the
// MetalTheme
return true;
}
return false;
}
/**
* Returns true if the high contrast theme should be used as the default
* theme.
*/
private static boolean useHighContrastTheme() {
if (isWindows() && useSystemFonts()) {
getDesktopProperty("win.highContrast.on");
booleanValue();
}
return false;
}
/**
* Returns true if we're using the Ocean Theme.
*/
static boolean usingOcean() {
return (getCurrentTheme() instanceof OceanTheme);
}
/**
* Returns the name of this look and feel. This returns
* {@code "Metal"}.
*
* @return the name of this look and feel
*/
return "Metal";
}
/**
* Returns an identifier for this look and feel. This returns
* {@code "Metal"}.
*
* @return the identifier of this look and feel
*/
return "Metal";
}
/**
* Returns a short description of this look and feel. This returns
* {@code "The Java(tm) Look and Feel"}.
* @return a short description for the look and feel
*/
return "The Java(tm) Look and Feel";
}
/**
* Returns {@code false}; {@code MetalLookAndFeel} is not a native
* look and feel.
*
* @return {@code false}
*/
public boolean isNativeLookAndFeel() {
return false;
}
/**
* Returns {@code true}; {@code MetalLookAndFeel} can be run on
* any platform.
*
* @return {@code true}
*/
public boolean isSupportedLookAndFeel() {
return true;
}
/**
* Returns {@code true}; metal can provide {@code Window}
* decorations.
*
* @return {@code true}
*
* @see JDialog#setDefaultLookAndFeelDecorated
* @see JFrame#setDefaultLookAndFeelDecorated
* @see JRootPane#setWindowDecorationStyle
* @since 1.4
*/
public boolean getSupportsWindowDecorations() {
return true;
}
/**
* Populates {@code table} with mappings from {@code uiClassID} to
* the fully qualified name of the ui class. {@code
* MetalLookAndFeel} registers an entry for each of the classes in
* the package {@code javax.swing.plaf.metal} that are named
* MetalXXXUI. The string {@code XXX} is one of Swing's uiClassIDs. For
* the {@code uiClassIDs} that do not have a class in metal, the
* corresponding class in {@code javax.swing.plaf.basic} is
* used. For example, metal does not have a class named {@code
* "MetalColorChooserUI"}, as such, {@code
* javax.swing.plaf.basic.BasicColorChooserUI} is used.
*
* @param table the {@code UIDefaults} instance the entries are
* added to
* @throws NullPointerException if {@code table} is {@code null}
*
* @see javax.swing.plaf.basic.BasicLookAndFeel#initClassDefaults
*/
{
super.initClassDefaults(table);
Object[] uiDefaults = {
};
}
/**
* Populates {@code table} with system colors. The following values are
* added to {@code table}:
* <table border="1" cellpadding="1" cellspacing="0"
* summary="Metal's system color mapping"
* valign="top" >
* <tr valign="top" align="left">
* <th bgcolor="#CCCCFF" align="left">Key
* <th bgcolor="#CCCCFF" align="left">Value
* <tr valign="top" align="left">
* <td>"desktop"
* <td>{@code theme.getDesktopColor()}
* <tr valign="top" align="left">
* <td>"activeCaption"
* <td>{@code theme.getWindowTitleBackground()}
* <tr valign="top" align="left">
* <td>"activeCaptionText"
* <td>{@code theme.getWindowTitleForeground()}
* <tr valign="top" align="left">
* <td>"activeCaptionBorder"
* <td>{@code theme.getPrimaryControlShadow()}
* <tr valign="top" align="left">
* <td>"inactiveCaption"
* <td>{@code theme.getWindowTitleInactiveBackground()}
* <tr valign="top" align="left">
* <td>"inactiveCaptionText"
* <td>{@code theme.getWindowTitleInactiveForeground()}
* <tr valign="top" align="left">
* <td>"inactiveCaptionBorder"
* <td>{@code theme.getControlShadow()}
* <tr valign="top" align="left">
* <td>"window"
* <td>{@code theme.getWindowBackground()}
* <tr valign="top" align="left">
* <td>"windowBorder"
* <td>{@code theme.getControl()}
* <tr valign="top" align="left">
* <td>"windowText"
* <td>{@code theme.getUserTextColor()}
* <tr valign="top" align="left">
* <td>"menu"
* <td>{@code theme.getMenuBackground()}
* <tr valign="top" align="left">
* <td>"menuText"
* <td>{@code theme.getMenuForeground()}
* <tr valign="top" align="left">
* <td>"text"
* <td>{@code theme.getWindowBackground()}
* <tr valign="top" align="left">
* <td>"textText"
* <td>{@code theme.getUserTextColor()}
* <tr valign="top" align="left">
* <td>"textHighlight"
* <td>{@code theme.getTextHighlightColor()}
* <tr valign="top" align="left">
* <td>"textHighlightText"
* <td>{@code theme.getHighlightedTextColor()}
* <tr valign="top" align="left">
* <td>"textInactiveText"
* <td>{@code theme.getInactiveSystemTextColor()}
* <tr valign="top" align="left">
* <td>"control"
* <td>{@code theme.getControl()}
* <tr valign="top" align="left">
* <td>"controlText"
* <td>{@code theme.getControlTextColor()}
* <tr valign="top" align="left">
* <td>"controlHighlight"
* <td>{@code theme.getControlHighlight()}
* <tr valign="top" align="left">
* <td>"controlLtHighlight"
* <td>{@code theme.getControlHighlight()}
* <tr valign="top" align="left">
* <td>"controlShadow"
* <td>{@code theme.getControlShadow()}
* <tr valign="top" align="left">
* <td>"controlDkShadow"
* <td>{@code theme.getControlDarkShadow()}
* <tr valign="top" align="left">
* <td>"scrollbar"
* <td>{@code theme.getControl()}
* <tr valign="top" align="left">
* <td>"info"
* <td>{@code theme.getPrimaryControl()}
* <tr valign="top" align="left">
* <td>"infoText"
* <td>{@code theme.getPrimaryControlInfo()}
* </table>
* The value {@code theme} corresponds to the current {@code MetalTheme}.
*
* @param table the {@code UIDefaults} object the values are added to
* @throws NullPointerException if {@code table} is {@code null}
*/
{
Object[] systemColors = {
"activeCaption", theme.getWindowTitleBackground(), /* Color for captions (title bars) when they are active. */
"activeCaptionText", theme.getWindowTitleForeground(), /* Text color for text in captions (title bars). */
"activeCaptionBorder", theme.getPrimaryControlShadow(), /* Border color for caption (title bar) window borders. */
"inactiveCaption", theme.getWindowTitleInactiveBackground(), /* Color for captions (title bars) when not active. */
"inactiveCaptionText", theme.getWindowTitleInactiveForeground(), /* Text color for text in inactive captions (title bars). */
"inactiveCaptionBorder", theme.getControlShadow(), /* Border color for inactive caption (title bar) window borders. */
};
}
/**
* Initialize the defaults table with the name of the ResourceBundle
* used for getting localized defaults.
*/
}
/**
* Populates {@code table} with the defaults for metal.
*
* @param table the {@code UIDefaults} to add the values to
* @throws NullPointerException if {@code table} is {@code null}
*/
super.initComponentDefaults( table );
new SwingLazyValue("javax.swing.plaf.metal.MetalBorders",
"getTextFieldBorder");
"javax.swing.plaf.metal.MetalBorders$DialogBorder");
"javax.swing.plaf.metal.MetalBorders$QuestionDialogBorder");
"ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
"control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
});
"ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
"control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
});
"shift PAGE_UP", "selection-page-up",
"shift PAGE_DOWN", "selection-page-down",
"ctrl shift PAGE_UP", "selection-page-left",
"ctrl shift PAGE_DOWN", "selection-page-right",
"ctrl BACK_SLASH", "unselect"/*DefaultEditorKit.unselectAction*/,
"ctrl T", "next-link-action",
"ctrl shift T", "previous-link-action",
"ctrl SPACE", "activate-link-action",
"control shift O", "toggle-componentOrientation"/*DefaultEditorKit.toggleComponentOrientation*/
});
Object scrollPaneBorder = new SwingLazyValue("javax.swing.plaf.metal.MetalBorders$ScrollPaneBorder");
new SwingLazyValue("javax.swing.plaf.metal.MetalBorders",
"getButtonBorder");
new SwingLazyValue("javax.swing.plaf.metal.MetalBorders",
"getToggleButtonBorder");
new SwingLazyValue(
"javax.swing.plaf.BorderUIResource$LineBorderUIResource",
new Object[] {controlShadow});
new SwingLazyValue(
"javax.swing.plaf.metal.MetalBorders",
"getDesktopIconBorder");
new SwingLazyValue(
"javax.swing.plaf.metal.MetalBorders$MenuBarBorder");
new SwingLazyValue(
"javax.swing.plaf.metal.MetalBorders$PopupMenuBorder");
new SwingLazyValue(
"javax.swing.plaf.metal.MetalBorders$MenuItemBorder");
"javax.swing.plaf.BorderUIResource$LineBorderUIResource",
"javax.swing.plaf.BorderUIResource$LineBorderUIResource",
new Object[] {primaryControlDarkShadow});
"javax.swing.plaf.BorderUIResource$LineBorderUIResource",
new Object[] {controlDarkShadow});
"javax.swing.plaf.BorderUIResource$LineBorderUIResource",
new Object[] {focusColor});
"OptionPane.errorSound",
"OptionPane.informationSound",
"OptionPane.questionSound",
"OptionPane.warningSound" };
//
// DEFAULTS TABLE
//
// *** Auditory Feedback
"AuditoryCues.defaultCueList", defaultCueList,
// this key defines which of the various cues to render
// This is disabled until sound bugs can be resolved.
// Text (Note: many are inherited)
"TextField.border", textFieldBorder,
"TextField.font", userTextValue,
"PasswordField.border", textFieldBorder,
// passwordField.font should actually map to
// win.ansiFixed.font.height on windows.
"PasswordField.font", userTextValue,
"PasswordField.echoChar", (char)0x2022,
// TextArea.font should actually map to win.ansiFixed.font.height
// on windows.
"TextArea.font", userTextValue,
"TextPane.font", userTextValue,
"EditorPane.font", userTextValue,
"TextField.focusInputMap", fieldInputMap,
"PasswordField.focusInputMap", passwordInputMap,
"TextArea.focusInputMap", multilineInputMap,
"TextPane.focusInputMap", multilineInputMap,
"EditorPane.focusInputMap", multilineInputMap,
// FormattedTextFields
"FormattedTextField.border", textFieldBorder,
"FormattedTextField.font", userTextValue,
"FormattedTextField.focusInputMap",
"ctrl BACK_SLASH", "unselect",
"control shift O", "toggle-componentOrientation",
"ESCAPE", "reset-field-edit",
"UP", "increment",
"KP_UP", "increment",
"DOWN", "decrement",
"KP_DOWN", "decrement",
}),
// Buttons
"Button.disabledText", inactiveControlTextColor,
"Button.select", controlShadow,
"Button.border", buttonBorder,
"Button.font", controlTextValue,
"Button.focus", focusColor,
"SPACE", "pressed",
"released SPACE", "released"
}),
"CheckBox.disabledText", inactiveControlTextColor,
"Checkbox.select", controlShadow,
"CheckBox.font", controlTextValue,
"CheckBox.focus", focusColor,
"CheckBox.focusInputMap",
"SPACE", "pressed",
"released SPACE", "released"
}),
// margin is 2 all the way around, BasicBorders.RadioButtonBorder
// (checkbox uses RadioButtonBorder) is 2 all the way around too.
"RadioButton.disabledText", inactiveControlTextColor,
"RadioButton.select", controlShadow,
"RadioButton.icon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getRadioButtonIcon"),
"RadioButton.font", controlTextValue,
"RadioButton.focus", focusColor,
"RadioButton.focusInputMap",
"SPACE", "pressed",
"released SPACE", "released"
}),
// margin is 2 all the way around, BasicBorders.RadioButtonBorder
// is 2 all the way around too.
"ToggleButton.select", controlShadow,
"ToggleButton.disabledText", inactiveControlTextColor,
"ToggleButton.focus", focusColor,
"ToggleButton.border", toggleButtonBorder,
"ToggleButton.font", controlTextValue,
"ToggleButton.focusInputMap",
"SPACE", "pressed",
"released SPACE", "released"
}),
// File View
"FileView.directoryIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFolderIcon"),
"FileView.fileIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeLeafIcon"),
"FileView.computerIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeComputerIcon"),
"FileView.hardDriveIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeHardDriveIcon"),
"FileView.floppyDriveIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFloppyDriveIcon"),
// File Chooser
"FileChooser.detailsViewIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserDetailViewIcon"),
"FileChooser.homeFolderIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserHomeFolderIcon"),
"FileChooser.listViewIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserListViewIcon"),
"FileChooser.newFolderIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserNewFolderIcon"),
"FileChooser.upFolderIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getFileChooserUpFolderIcon"),
"FileChooser.ancestorInputMap",
"ESCAPE", "cancelSelection",
"F2", "editFileName",
"F5", "refresh",
"BACK_SPACE", "Go Up"
}),
// ToolTip
"ToolTip.font", systemTextValue,
"ToolTip.border", toolTipBorder,
"ToolTip.borderInactive", toolTipBorderInactive,
"ToolTip.backgroundInactive", control,
"ToolTip.foregroundInactive", controlDarkShadow,
// ToolTipManager
"ToolTipManager.enableToolTipMode", "activeApplication",
// Slider Defaults
"Slider.font", controlTextValue,
"Slider.border", null,
"Slider.foreground", primaryControlShadow,
"Slider.focus", focusColor,
"Slider.focusInsets", zeroInsets,
"Slider.horizontalThumbIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getHorizontalSliderThumbIcon"),
"Slider.verticalThumbIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getVerticalSliderThumbIcon"),
"Slider.focusInputMap",
"RIGHT", "positiveUnitIncrement",
"KP_RIGHT", "positiveUnitIncrement",
"DOWN", "negativeUnitIncrement",
"KP_DOWN", "negativeUnitIncrement",
"PAGE_DOWN", "negativeBlockIncrement",
"ctrl PAGE_DOWN", "negativeBlockIncrement",
"LEFT", "negativeUnitIncrement",
"KP_LEFT", "negativeUnitIncrement",
"UP", "positiveUnitIncrement",
"KP_UP", "positiveUnitIncrement",
"PAGE_UP", "positiveBlockIncrement",
"ctrl PAGE_UP", "positiveBlockIncrement",
"HOME", "minScroll",
"END", "maxScroll"
}),
// Progress Bar
"ProgressBar.font", controlTextValue,
"ProgressBar.foreground", primaryControlShadow,
"ProgressBar.selectionBackground", primaryControlDarkShadow,
"ProgressBar.border", progressBarBorder,
"ProgressBar.cellSpacing", zero,
// Combo Box
"ComboBox.background", control,
"ComboBox.foreground", controlTextColor,
"ComboBox.selectionBackground", primaryControlShadow,
"ComboBox.selectionForeground", controlTextColor,
"ComboBox.font", controlTextValue,
"ESCAPE", "hidePopup",
"PAGE_UP", "pageUpPassThrough",
"PAGE_DOWN", "pageDownPassThrough",
"HOME", "homePassThrough",
"END", "endPassThrough",
"DOWN", "selectNext",
"KP_DOWN", "selectNext",
"alt DOWN", "togglePopup",
"alt KP_DOWN", "togglePopup",
"alt UP", "togglePopup",
"alt KP_UP", "togglePopup",
"SPACE", "spacePopup",
"ENTER", "enterPressed",
"UP", "selectPrevious",
"KP_UP", "selectPrevious"
}),
// Internal Frame Defaults
"InternalFrame.icon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getInternalFrameDefaultMenuIcon"),
"InternalFrame.border", new SwingLazyValue("javax.swing.plaf.metal.MetalBorders$InternalFrameBorder"),
"InternalFrame.optionDialogBorder", new SwingLazyValue("javax.swing.plaf.metal.MetalBorders$OptionDialogBorder"),
"InternalFrame.paletteBorder", new SwingLazyValue("javax.swing.plaf.metal.MetalBorders$PaletteBorder"),
"InternalFrame.paletteCloseIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory$PaletteCloseIcon"),
"InternalFrame.closeIcon",
new SwingLazyValue(
"javax.swing.plaf.metal.MetalIconFactory",
"getInternalFrameCloseIcon",
"InternalFrame.maximizeIcon",
new SwingLazyValue(
"javax.swing.plaf.metal.MetalIconFactory",
"getInternalFrameMaximizeIcon",
"InternalFrame.iconifyIcon",
new SwingLazyValue(
"javax.swing.plaf.metal.MetalIconFactory",
"getInternalFrameMinimizeIcon",
"InternalFrame.minimizeIcon",
new SwingLazyValue(
"javax.swing.plaf.metal.MetalIconFactory",
"getInternalFrameAltMaximizeIcon",
"InternalFrame.titleFont", windowTitleValue,
"InternalFrame.windowBindings", null,
// Internal Frame Auditory Cue Mappings
"InternalFrame.closeSound", "sounds/FrameClose.wav",
"InternalFrame.maximizeSound", "sounds/FrameMaximize.wav",
"InternalFrame.minimizeSound", "sounds/FrameMinimize.wav",
"InternalFrame.restoreDownSound", "sounds/FrameRestoreDown.wav",
"InternalFrame.restoreUpSound", "sounds/FrameRestoreUp.wav",
// Desktop Icon
"DesktopIcon.border", desktopIconBorder,
"DesktopIcon.font", controlTextValue,
"DesktopIcon.foreground", controlTextColor,
"DesktopIcon.background", control,
"Desktop.ancestorInputMap",
"ctrl F5", "restore",
"ctrl F4", "close",
"ctrl F7", "move",
"ctrl F8", "resize",
"RIGHT", "right",
"KP_RIGHT", "right",
"shift RIGHT", "shrinkRight",
"shift KP_RIGHT", "shrinkRight",
"LEFT", "left",
"KP_LEFT", "left",
"shift LEFT", "shrinkLeft",
"shift KP_LEFT", "shrinkLeft",
"UP", "up",
"KP_UP", "up",
"shift UP", "shrinkUp",
"shift KP_UP", "shrinkUp",
"DOWN", "down",
"KP_DOWN", "down",
"shift DOWN", "shrinkDown",
"shift KP_DOWN", "shrinkDown",
"ESCAPE", "escape",
"ctrl F9", "minimize",
"ctrl F10", "maximize",
"ctrl F6", "selectNextFrame",
"ctrl TAB", "selectNextFrame",
"ctrl alt F6", "selectNextFrame",
"shift ctrl alt F6", "selectPreviousFrame",
"ctrl F12", "navigateNext",
"shift ctrl F12", "navigatePrevious"
}),
// Titled Border
"TitledBorder.font", controlTextValue,
"TitledBorder.titleColor", systemTextColor,
"TitledBorder.border", titledBorderBorder,
// Label
"Label.font", controlTextValue,
"Label.foreground", systemTextColor,
"Label.disabledForeground", getInactiveSystemTextColor(),
// List
"List.font", controlTextValue,
"List.focusCellHighlightBorder", focusCellHighlightBorder,
"List.focusInputMap",
"ctrl C", "copy",
"ctrl V", "paste",
"ctrl X", "cut",
"COPY", "copy",
"PASTE", "paste",
"CUT", "cut",
"control INSERT", "copy",
"shift INSERT", "paste",
"shift DELETE", "cut",
"UP", "selectPreviousRow",
"KP_UP", "selectPreviousRow",
"shift UP", "selectPreviousRowExtendSelection",
"shift KP_UP", "selectPreviousRowExtendSelection",
"ctrl shift UP", "selectPreviousRowExtendSelection",
"ctrl shift KP_UP", "selectPreviousRowExtendSelection",
"ctrl UP", "selectPreviousRowChangeLead",
"ctrl KP_UP", "selectPreviousRowChangeLead",
"DOWN", "selectNextRow",
"KP_DOWN", "selectNextRow",
"shift DOWN", "selectNextRowExtendSelection",
"shift KP_DOWN", "selectNextRowExtendSelection",
"ctrl shift DOWN", "selectNextRowExtendSelection",
"ctrl shift KP_DOWN", "selectNextRowExtendSelection",
"ctrl DOWN", "selectNextRowChangeLead",
"ctrl KP_DOWN", "selectNextRowChangeLead",
"LEFT", "selectPreviousColumn",
"KP_LEFT", "selectPreviousColumn",
"shift LEFT", "selectPreviousColumnExtendSelection",
"shift KP_LEFT", "selectPreviousColumnExtendSelection",
"ctrl shift LEFT", "selectPreviousColumnExtendSelection",
"ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
"ctrl LEFT", "selectPreviousColumnChangeLead",
"ctrl KP_LEFT", "selectPreviousColumnChangeLead",
"RIGHT", "selectNextColumn",
"KP_RIGHT", "selectNextColumn",
"shift RIGHT", "selectNextColumnExtendSelection",
"shift KP_RIGHT", "selectNextColumnExtendSelection",
"ctrl shift RIGHT", "selectNextColumnExtendSelection",
"ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
"ctrl RIGHT", "selectNextColumnChangeLead",
"ctrl KP_RIGHT", "selectNextColumnChangeLead",
"HOME", "selectFirstRow",
"shift HOME", "selectFirstRowExtendSelection",
"ctrl shift HOME", "selectFirstRowExtendSelection",
"ctrl HOME", "selectFirstRowChangeLead",
"END", "selectLastRow",
"shift END", "selectLastRowExtendSelection",
"ctrl shift END", "selectLastRowExtendSelection",
"ctrl END", "selectLastRowChangeLead",
"PAGE_UP", "scrollUp",
"shift PAGE_UP", "scrollUpExtendSelection",
"ctrl shift PAGE_UP", "scrollUpExtendSelection",
"ctrl PAGE_UP", "scrollUpChangeLead",
"PAGE_DOWN", "scrollDown",
"shift PAGE_DOWN", "scrollDownExtendSelection",
"ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
"ctrl PAGE_DOWN", "scrollDownChangeLead",
"ctrl A", "selectAll",
"ctrl SLASH", "selectAll",
"ctrl BACK_SLASH", "clearSelection",
"SPACE", "addToSelection",
"ctrl SPACE", "toggleAndAnchor",
"shift SPACE", "extendTo",
"ctrl shift SPACE", "moveSelectionTo"
}),
// ScrollBar
"ScrollBar.background", control,
"ScrollBar.highlight", controlHighlight,
"ScrollBar.shadow", controlShadow,
"ScrollBar.darkShadow", controlDarkShadow,
"ScrollBar.thumb", primaryControlShadow,
"ScrollBar.thumbShadow", primaryControlDarkShadow,
"ScrollBar.thumbHighlight", primaryControl,
"ScrollBar.ancestorInputMap",
"RIGHT", "positiveUnitIncrement",
"KP_RIGHT", "positiveUnitIncrement",
"DOWN", "positiveUnitIncrement",
"KP_DOWN", "positiveUnitIncrement",
"PAGE_DOWN", "positiveBlockIncrement",
"LEFT", "negativeUnitIncrement",
"KP_LEFT", "negativeUnitIncrement",
"UP", "negativeUnitIncrement",
"KP_UP", "negativeUnitIncrement",
"PAGE_UP", "negativeBlockIncrement",
"HOME", "minScroll",
"END", "maxScroll"
}),
// ScrollPane
"ScrollPane.border", scrollPaneBorder,
"ScrollPane.ancestorInputMap",
"RIGHT", "unitScrollRight",
"KP_RIGHT", "unitScrollRight",
"DOWN", "unitScrollDown",
"KP_DOWN", "unitScrollDown",
"LEFT", "unitScrollLeft",
"KP_LEFT", "unitScrollLeft",
"UP", "unitScrollUp",
"KP_UP", "unitScrollUp",
"PAGE_UP", "scrollUp",
"PAGE_DOWN", "scrollDown",
"ctrl PAGE_UP", "scrollLeft",
"ctrl PAGE_DOWN", "scrollRight",
"ctrl HOME", "scrollHome",
"ctrl END", "scrollEnd"
}),
// Tabbed Pane
"TabbedPane.font", controlTextValue,
"TabbedPane.tabAreaBackground", control,
"TabbedPane.background", controlShadow,
"TabbedPane.light", control,
"TabbedPane.focus", primaryControlDarkShadow,
"TabbedPane.selected", control,
"TabbedPane.selectHighlight", controlHighlight,
"TabbedPane.tabAreaInsets", tabbedPaneTabAreaInsets,
"TabbedPane.tabInsets", tabbedPaneTabInsets,
"TabbedPane.focusInputMap",
"RIGHT", "navigateRight",
"KP_RIGHT", "navigateRight",
"LEFT", "navigateLeft",
"KP_LEFT", "navigateLeft",
"UP", "navigateUp",
"KP_UP", "navigateUp",
"DOWN", "navigateDown",
"KP_DOWN", "navigateDown",
"ctrl DOWN", "requestFocusForVisibleComponent",
"ctrl KP_DOWN", "requestFocusForVisibleComponent",
}),
"TabbedPane.ancestorInputMap",
"ctrl PAGE_DOWN", "navigatePageDown",
"ctrl PAGE_UP", "navigatePageUp",
"ctrl UP", "requestFocus",
"ctrl KP_UP", "requestFocus",
}),
// Table
"Table.font", userTextValue,
"Table.focusCellHighlightBorder", focusCellHighlightBorder,
"Table.scrollPaneBorder", scrollPaneBorder,
"Table.dropLineColor", focusColor,
"Table.dropLineShortColor", primaryControlDarkShadow,
"Table.ancestorInputMap",
"ctrl C", "copy",
"ctrl V", "paste",
"ctrl X", "cut",
"COPY", "copy",
"PASTE", "paste",
"CUT", "cut",
"control INSERT", "copy",
"shift INSERT", "paste",
"shift DELETE", "cut",
"RIGHT", "selectNextColumn",
"KP_RIGHT", "selectNextColumn",
"shift RIGHT", "selectNextColumnExtendSelection",
"shift KP_RIGHT", "selectNextColumnExtendSelection",
"ctrl shift RIGHT", "selectNextColumnExtendSelection",
"ctrl shift KP_RIGHT", "selectNextColumnExtendSelection",
"ctrl RIGHT", "selectNextColumnChangeLead",
"ctrl KP_RIGHT", "selectNextColumnChangeLead",
"LEFT", "selectPreviousColumn",
"KP_LEFT", "selectPreviousColumn",
"shift LEFT", "selectPreviousColumnExtendSelection",
"shift KP_LEFT", "selectPreviousColumnExtendSelection",
"ctrl shift LEFT", "selectPreviousColumnExtendSelection",
"ctrl shift KP_LEFT", "selectPreviousColumnExtendSelection",
"ctrl LEFT", "selectPreviousColumnChangeLead",
"ctrl KP_LEFT", "selectPreviousColumnChangeLead",
"DOWN", "selectNextRow",
"KP_DOWN", "selectNextRow",
"shift DOWN", "selectNextRowExtendSelection",
"shift KP_DOWN", "selectNextRowExtendSelection",
"ctrl shift DOWN", "selectNextRowExtendSelection",
"ctrl shift KP_DOWN", "selectNextRowExtendSelection",
"ctrl DOWN", "selectNextRowChangeLead",
"ctrl KP_DOWN", "selectNextRowChangeLead",
"UP", "selectPreviousRow",
"KP_UP", "selectPreviousRow",
"shift UP", "selectPreviousRowExtendSelection",
"shift KP_UP", "selectPreviousRowExtendSelection",
"ctrl shift UP", "selectPreviousRowExtendSelection",
"ctrl shift KP_UP", "selectPreviousRowExtendSelection",
"ctrl UP", "selectPreviousRowChangeLead",
"ctrl KP_UP", "selectPreviousRowChangeLead",
"HOME", "selectFirstColumn",
"shift HOME", "selectFirstColumnExtendSelection",
"ctrl shift HOME", "selectFirstRowExtendSelection",
"ctrl HOME", "selectFirstRow",
"END", "selectLastColumn",
"shift END", "selectLastColumnExtendSelection",
"ctrl shift END", "selectLastRowExtendSelection",
"ctrl END", "selectLastRow",
"PAGE_UP", "scrollUpChangeSelection",
"shift PAGE_UP", "scrollUpExtendSelection",
"ctrl shift PAGE_UP", "scrollLeftExtendSelection",
"ctrl PAGE_UP", "scrollLeftChangeSelection",
"PAGE_DOWN", "scrollDownChangeSelection",
"shift PAGE_DOWN", "scrollDownExtendSelection",
"ctrl shift PAGE_DOWN", "scrollRightExtendSelection",
"ctrl PAGE_DOWN", "scrollRightChangeSelection",
"TAB", "selectNextColumnCell",
"shift TAB", "selectPreviousColumnCell",
"ENTER", "selectNextRowCell",
"shift ENTER", "selectPreviousRowCell",
"ctrl A", "selectAll",
"ctrl SLASH", "selectAll",
"ctrl BACK_SLASH", "clearSelection",
"ESCAPE", "cancel",
"F2", "startEditing",
"SPACE", "addToSelection",
"ctrl SPACE", "toggleAndAnchor",
"shift SPACE", "extendTo",
"ctrl shift SPACE", "moveSelectionTo",
"F8", "focusHeader"
}),
"Table.ascendingSortIcon",
"icons/sortUp.png"),
"Table.descendingSortIcon",
"icons/sortDown.png"),
"TableHeader.font", userTextValue,
"TableHeader.cellBorder", new SwingLazyValue(
"javax.swing.plaf.metal.MetalBorders$TableHeaderBorder"),
// MenuBar
"MenuBar.border", menuBarBorder,
"MenuBar.font", menuTextValue,
"MenuBar.windowBindings", new Object[] {
"F10", "takeFocus" },
// Menu
"Menu.border", menuItemBorder,
"Menu.menuPopupOffsetX", zero,
"Menu.menuPopupOffsetY", zero,
"Menu.font", menuTextValue,
"Menu.selectionForeground", menuSelectedForeground,
"Menu.selectionBackground", menuSelectedBackground,
"Menu.disabledForeground", menuDisabledForeground,
"Menu.acceleratorFont", subTextValue,
"Menu.acceleratorForeground", acceleratorForeground,
"Menu.acceleratorSelectionForeground", acceleratorSelectedForeground,
"Menu.checkIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemCheckIcon"),
"Menu.arrowIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuArrowIcon"),
// Menu Item
"MenuItem.border", menuItemBorder,
"MenuItem.font", menuTextValue,
"MenuItem.selectionForeground", menuSelectedForeground,
"MenuItem.selectionBackground", menuSelectedBackground,
"MenuItem.disabledForeground", menuDisabledForeground,
"MenuItem.acceleratorFont", subTextValue,
"MenuItem.acceleratorForeground", acceleratorForeground,
"MenuItem.acceleratorSelectionForeground", acceleratorSelectedForeground,
"MenuItem.acceleratorDelimiter", menuItemAcceleratorDelimiter,
"MenuItem.checkIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemCheckIcon"),
"MenuItem.arrowIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemArrowIcon"),
// Menu Item Auditory Cue Mapping
"MenuItem.commandSound", "sounds/MenuItemCommand.wav",
// OptionPane.
"OptionPane.windowBindings", new Object[] {
"ESCAPE", "close" },
// Option Pane Auditory Cue Mappings
"OptionPane.informationSound", "sounds/OptionPaneInformation.wav",
"OptionPane.warningSound", "sounds/OptionPaneWarning.wav",
"OptionPane.errorSound", "sounds/OptionPaneError.wav",
"OptionPane.questionSound", "sounds/OptionPaneQuestion.wav",
// Option Pane Special Dialog Colors, used when MetalRootPaneUI
// is providing window manipulation widgets.
"OptionPane.errorDialog.border.background",
"OptionPane.errorDialog.titlePane.foreground",
"OptionPane.errorDialog.titlePane.background",
"OptionPane.errorDialog.titlePane.shadow",
"OptionPane.questionDialog.border.background",
"OptionPane.questionDialog.titlePane.foreground",
"OptionPane.questionDialog.titlePane.background",
"OptionPane.questionDialog.titlePane.shadow",
"OptionPane.warningDialog.border.background",
"OptionPane.warningDialog.titlePane.foreground",
"OptionPane.warningDialog.titlePane.background",
"OptionPane.warningDialog.titlePane.shadow",
// OptionPane fonts are defined below
// Separator
"Separator.background", getSeparatorBackground(),
"Separator.foreground", getSeparatorForeground(),
// Popup Menu
"PopupMenu.border", popupMenuBorder,
// Popup Menu Auditory Cue Mappings
"PopupMenu.popupSound", "sounds/PopupMenuPopup.wav",
"PopupMenu.font", menuTextValue,
// CB & RB Menu Item
"CheckBoxMenuItem.border", menuItemBorder,
"CheckBoxMenuItem.font", menuTextValue,
"CheckBoxMenuItem.selectionForeground", menuSelectedForeground,
"CheckBoxMenuItem.selectionBackground", menuSelectedBackground,
"CheckBoxMenuItem.disabledForeground", menuDisabledForeground,
"CheckBoxMenuItem.acceleratorFont", subTextValue,
"CheckBoxMenuItem.acceleratorForeground", acceleratorForeground,
"CheckBoxMenuItem.acceleratorSelectionForeground", acceleratorSelectedForeground,
"CheckBoxMenuItem.checkIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getCheckBoxMenuItemIcon"),
"CheckBoxMenuItem.arrowIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemArrowIcon"),
"CheckBoxMenuItem.commandSound", "sounds/MenuItemCommand.wav",
"RadioButtonMenuItem.border", menuItemBorder,
"RadioButtonMenuItem.font", menuTextValue,
"RadioButtonMenuItem.selectionForeground", menuSelectedForeground,
"RadioButtonMenuItem.selectionBackground", menuSelectedBackground,
"RadioButtonMenuItem.disabledForeground", menuDisabledForeground,
"RadioButtonMenuItem.acceleratorFont", subTextValue,
"RadioButtonMenuItem.acceleratorForeground", acceleratorForeground,
"RadioButtonMenuItem.acceleratorSelectionForeground", acceleratorSelectedForeground,
"RadioButtonMenuItem.checkIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getRadioButtonMenuItemIcon"),
"RadioButtonMenuItem.arrowIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getMenuItemArrowIcon"),
"RadioButtonMenuItem.commandSound", "sounds/MenuItemCommand.wav",
"Spinner.ancestorInputMap",
"UP", "increment",
"KP_UP", "increment",
"DOWN", "decrement",
"KP_DOWN", "decrement",
}),
"Spinner.arrowButtonInsets", zeroInsets,
"Spinner.border", textFieldBorder,
"Spinner.arrowButtonBorder", buttonBorder,
"Spinner.font", controlTextValue,
// SplitPane
"SplitPane.ancestorInputMap",
"UP", "negativeIncrement",
"DOWN", "positiveIncrement",
"LEFT", "negativeIncrement",
"RIGHT", "positiveIncrement",
"KP_UP", "negativeIncrement",
"KP_DOWN", "positiveIncrement",
"KP_LEFT", "negativeIncrement",
"KP_RIGHT", "positiveIncrement",
"HOME", "selectMin",
"END", "selectMax",
"F8", "startResize",
"F6", "toggleFocus",
"ctrl TAB", "focusOutForward",
"ctrl shift TAB", "focusOutBackward"
}),
"SplitPane.dividerFocusColor", primaryControl,
// Tree
// Tree.font was mapped to system font pre 1.4.1
"Tree.font", userTextValue,
"Tree.textBackground", getWindowBackground(),
"Tree.selectionBorderColor", focusColor,
"Tree.openIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFolderIcon"),
"Tree.closedIcon", new SwingLazyValue("javax.swing.plaf.metal.MetalIconFactory", "getTreeFolderIcon"),
"Tree.expandedIcon", new SwingLazyValue(
"javax.swing.plaf.metal.MetalIconFactory",
"getTreeControlIcon",
"Tree.collapsedIcon", new SwingLazyValue(
"javax.swing.plaf.metal.MetalIconFactory",
"getTreeControlIcon",
"Tree.rowHeight", zero,
"Tree.focusInputMap",
"ADD", "expand",
"SUBTRACT", "collapse",
"ctrl C", "copy",
"ctrl V", "paste",
"ctrl X", "cut",
"COPY", "copy",
"PASTE", "paste",
"CUT", "cut",
"control INSERT", "copy",
"shift INSERT", "paste",
"shift DELETE", "cut",
"UP", "selectPrevious",
"KP_UP", "selectPrevious",
"shift UP", "selectPreviousExtendSelection",
"shift KP_UP", "selectPreviousExtendSelection",
"ctrl shift UP", "selectPreviousExtendSelection",
"ctrl shift KP_UP", "selectPreviousExtendSelection",
"ctrl UP", "selectPreviousChangeLead",
"ctrl KP_UP", "selectPreviousChangeLead",
"DOWN", "selectNext",
"KP_DOWN", "selectNext",
"shift DOWN", "selectNextExtendSelection",
"shift KP_DOWN", "selectNextExtendSelection",
"ctrl shift DOWN", "selectNextExtendSelection",
"ctrl shift KP_DOWN", "selectNextExtendSelection",
"ctrl DOWN", "selectNextChangeLead",
"ctrl KP_DOWN", "selectNextChangeLead",
"RIGHT", "selectChild",
"KP_RIGHT", "selectChild",
"LEFT", "selectParent",
"KP_LEFT", "selectParent",
"PAGE_UP", "scrollUpChangeSelection",
"shift PAGE_UP", "scrollUpExtendSelection",
"ctrl shift PAGE_UP", "scrollUpExtendSelection",
"ctrl PAGE_UP", "scrollUpChangeLead",
"PAGE_DOWN", "scrollDownChangeSelection",
"shift PAGE_DOWN", "scrollDownExtendSelection",
"ctrl shift PAGE_DOWN", "scrollDownExtendSelection",
"ctrl PAGE_DOWN", "scrollDownChangeLead",
"HOME", "selectFirst",
"shift HOME", "selectFirstExtendSelection",
"ctrl shift HOME", "selectFirstExtendSelection",
"ctrl HOME", "selectFirstChangeLead",
"END", "selectLast",
"shift END", "selectLastExtendSelection",
"ctrl shift END", "selectLastExtendSelection",
"ctrl END", "selectLastChangeLead",
"F2", "startEditing",
"ctrl A", "selectAll",
"ctrl SLASH", "selectAll",
"ctrl BACK_SLASH", "clearSelection",
"ctrl LEFT", "scrollLeft",
"ctrl KP_LEFT", "scrollLeft",
"ctrl RIGHT", "scrollRight",
"ctrl KP_RIGHT", "scrollRight",
"SPACE", "addToSelection",
"ctrl SPACE", "toggleAndAnchor",
"shift SPACE", "extendTo",
"ctrl shift SPACE", "moveSelectionTo"
}),
"Tree.ancestorInputMap",
"ESCAPE", "cancel"
}),
// ToolBar
"ToolBar.border", toolBarBorder,
"ToolBar.background", menuBackground,
"ToolBar.foreground", getMenuForeground(),
"ToolBar.font", menuTextValue,
"ToolBar.dockingBackground", menuBackground,
"ToolBar.floatingBackground", menuBackground,
"ToolBar.dockingForeground", primaryControlDarkShadow,
"ToolBar.floatingForeground", primaryControl,
"ToolBar.rolloverBorder", new MetalLazyValue(
"javax.swing.plaf.metal.MetalBorders",
"getToolBarRolloverBorder"),
"ToolBar.nonrolloverBorder", new MetalLazyValue(
"javax.swing.plaf.metal.MetalBorders",
"getToolBarNonrolloverBorder"),
"ToolBar.ancestorInputMap",
"UP", "navigateUp",
"KP_UP", "navigateUp",
"DOWN", "navigateDown",
"KP_DOWN", "navigateDown",
"LEFT", "navigateLeft",
"KP_LEFT", "navigateLeft",
"RIGHT", "navigateRight",
"KP_RIGHT", "navigateRight"
}),
// RootPane
"RootPane.frameBorder", new MetalLazyValue(
"javax.swing.plaf.metal.MetalBorders$FrameBorder"),
"RootPane.plainDialogBorder", dialogBorder,
"RootPane.informationDialogBorder", dialogBorder,
"RootPane.errorDialogBorder", new MetalLazyValue(
"javax.swing.plaf.metal.MetalBorders$ErrorDialogBorder"),
"RootPane.colorChooserDialogBorder", questionDialogBorder,
"RootPane.fileChooserDialogBorder", questionDialogBorder,
"RootPane.questionDialogBorder", questionDialogBorder,
"RootPane.warningDialogBorder", new MetalLazyValue(
"javax.swing.plaf.metal.MetalBorders$WarningDialogBorder"),
// These bindings are only enabled when there is a default
// button set on the rootpane.
"RootPane.defaultButtonWindowKeyBindings", new Object[] {
"ENTER", "press",
"released ENTER", "release",
"ctrl ENTER", "press",
"ctrl released ENTER", "release"
},
};
"OptionPane.messageFont", messageFont,
"OptionPane.buttonFont", messageFont,
};
}
flushUnreferenced(); // Remove old listeners
new AATextListener(this);
}
/**
* Ensures the current {@code MetalTheme} is {@code non-null}. This is
* a cover method for {@code getCurrentTheme}.
*
* @see #getCurrentTheme
*/
protected void createDefaultTheme() {
}
/**
* Returns the look and feel defaults. This invokes, in order,
* {@code createDefaultTheme()}, {@code super.getDefaults()} and
* {@code getCurrentTheme().addCustomEntriesToTable(table)}.
* <p>
* While this method is public, it should only be invoked by the
* {@code UIManager} when the look and feel is set as the current
* look and feel and after {@code initialize} has been invoked.
*
* @return the look and feel defaults
*
* @see #createDefaultTheme
* @see javax.swing.plaf.basic.BasicLookAndFeel#getDefaults()
* @see MetalTheme#addCustomEntriesToTable(UIDefaults)
*/
// PENDING: move this to initialize when API changes are allowed
METAL_LOOK_AND_FEEL_INITED = true;
return table;
}
/**
* {@inheritDoc}
*
* @since 1.4
*/
super.provideErrorFeedback(component);
}
/**
* Set the theme used by <code>MetalLookAndFeel</code>.
* <p>
* After the theme is set, {@code MetalLookAndFeel} needs to be
* re-installed and the uis need to be recreated. The following
* shows how to do this:
* <pre>
* 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);
* </pre>
* If this is not done the results are undefined.
*
* @param theme the theme to use
* @throws NullPointerException if {@code theme} is {@code null}
* @see #getCurrentTheme
*/
// NOTE: because you need to recreate the look and feel after
// this step, we don't bother blowing away any potential windows
// values.
throw new NullPointerException("Can't have null theme");
}
}
/**
* Return the theme currently being used by <code>MetalLookAndFeel</code>.
* If the current theme is {@code null}, the default theme is created.
*
* @return the current theme
* @see #setCurrentTheme
* @since 1.5
*/
if (currentTheme == null) {
// This will happen in two cases:
// . When MetalLookAndFeel is first being initialized.
// . When a new AppContext has been created that hasn't
// triggered UIManager to load a LAF. Rather than invoke
// a method on the UIManager, which would trigger the loading
// of a potentially different LAF, we directly set the
// Theme here.
if (useHighContrastTheme()) {
currentTheme = new MetalHighContrastTheme();
}
else {
// Create the default theme. We prefer Ocean, but will
// use DefaultMetalTheme if told to.
new GetPropertyAction("swing.metalTheme"));
currentTheme = new DefaultMetalTheme();
}
else {
currentTheme = new OceanTheme();
}
}
}
return currentTheme;
}
/**
* Returns an <code>Icon</code> with a disabled appearance.
* This method is used to generate a disabled <code>Icon</code> when
* one has not been specified. For example, if you create a
* <code>JButton</code> and only specify an <code>Icon</code> via
* <code>setIcon</code> this method will be called to generate the
* disabled <code>Icon</code>. If null is passed as <code>icon</code>
* this method returns null.
* <p>
* Some look and feels might not render the disabled Icon, in which
* case they will ignore this.
*
* @param component JComponent that will display the Icon, may be null
* @param icon Icon to generate disable icon from.
* @return Disabled icon, or null if a suitable Icon can not be
* generated.
* @since 1.5
*/
return MetalUtils.getOceanDisabledButtonIcon(
}
}
/**
* Returns an <code>Icon</code> for use by disabled
* components that are also selected. This method is used to generate an
* <code>Icon</code> for components that are in both the disabled and
* selected states but do not have a specific <code>Icon</code> for this
* state. For example, if you create a <code>JButton</code> and only
* specify an <code>Icon</code> via <code>setIcon</code> this method
* will be called to generate the disabled and selected
* <code>Icon</code>. If null is passed as <code>icon</code> this method
* returns null.
* <p>
* Some look and feels might not render the disabled and selected Icon,
* in which case they will ignore this.
*
* @param component JComponent that will display the Icon, may be null
* @param icon Icon to generate disabled and selected icon from.
* @return Disabled and Selected icon, or null if a suitable Icon can not
* be generated.
* @since 1.5
*/
return MetalUtils.getOceanDisabledButtonIcon(
}
}
/**
* Returns the control text font of the current theme. This is a
* cover method for {@code getCurrentTheme().getControlTextColor()}.
*
* @return the control text font
*
* @see MetalTheme
*/
/**
* Returns the sytem text font of the current theme. This is a
* cover method for {@code getCurrentTheme().getSystemTextFont()}.
*
* @return the system text font
*
* @see MetalTheme
*/
/**
* Returns the user text font of the current theme. This is a
* cover method for {@code getCurrentTheme().getUserTextFont()}.
*
* @return the user text font
*
* @see MetalTheme
*/
/**
* Returns the menu text font of the current theme. This is a
* cover method for {@code getCurrentTheme().getMenuTextFont()}.
*
* @return the menu text font
*
* @see MetalTheme
*/
/**
* Returns the window title font of the current theme. This is a
* cover method for {@code getCurrentTheme().getWindowTitleFont()}.
*
* @return the window title font
*
* @see MetalTheme
*/
/**
* Returns the sub-text font of the current theme. This is a
* cover method for {@code getCurrentTheme().getSubTextFont()}.
*
* @return the sub-text font
*
* @see MetalTheme
*/
/**
* Returns the desktop color of the current theme. This is a
* cover method for {@code getCurrentTheme().getDesktopColor()}.
*
* @return the desktop color
*
* @see MetalTheme
*/
/**
* Returns the focus color of the current theme. This is a
* cover method for {@code getCurrentTheme().getFocusColor()}.
*
* @return the focus color
*
* @see MetalTheme
*/
/**
* Returns the white color of the current theme. This is a
* cover method for {@code getCurrentTheme().getWhite()}.
*
* @return the white color
*
* @see MetalTheme
*/
/**
* Returns the black color of the current theme. This is a
* cover method for {@code getCurrentTheme().getBlack()}.
*
* @return the black color
*
* @see MetalTheme
*/
/**
* Returns the control color of the current theme. This is a
* cover method for {@code getCurrentTheme().getControl()}.
*
* @return the control color
*
* @see MetalTheme
*/
/**
* Returns the control shadow color of the current theme. This is a
* cover method for {@code getCurrentTheme().getControlShadow()}.
*
* @return the control shadow color
*
* @see MetalTheme
*/
/**
* Returns the control dark shadow color of the current theme. This is a
* cover method for {@code getCurrentTheme().getControlDarkShadow()}.
*
* @return the control dark shadow color
*
* @see MetalTheme
*/
public static ColorUIResource getControlDarkShadow() { return getCurrentTheme().getControlDarkShadow(); }
/**
* Returns the control info color of the current theme. This is a
* cover method for {@code getCurrentTheme().getControlInfo()}.
*
* @return the control info color
*
* @see MetalTheme
*/
/**
* Returns the control highlight color of the current theme. This is a
* cover method for {@code getCurrentTheme().getControlHighlight()}.
*
* @return the control highlight color
*
* @see MetalTheme
*/
public static ColorUIResource getControlHighlight() { return getCurrentTheme().getControlHighlight(); }
/**
* Returns the control disabled color of the current theme. This is a
* cover method for {@code getCurrentTheme().getControlDisabled()}.
*
* @return the control disabled color
*
* @see MetalTheme
*/
public static ColorUIResource getControlDisabled() { return getCurrentTheme().getControlDisabled(); }
/**
* Returns the primary control color of the current theme. This is a
* cover method for {@code getCurrentTheme().getPrimaryControl()}.
*
* @return the primary control color
*
* @see MetalTheme
*/
/**
* Returns the primary control shadow color of the current theme. This is a
* cover method for {@code getCurrentTheme().getPrimaryControlShadow()}.
*
* @return the primary control shadow color
*
* @see MetalTheme
*/
public static ColorUIResource getPrimaryControlShadow() { return getCurrentTheme().getPrimaryControlShadow(); }
/**
* Returns the primary control dark shadow color of the current
* theme. This is a cover method for {@code
* getCurrentTheme().getPrimaryControlDarkShadow()}.
*
* @return the primary control dark shadow color
*
* @see MetalTheme
*/
public static ColorUIResource getPrimaryControlDarkShadow() { return getCurrentTheme().getPrimaryControlDarkShadow(); }
/**
* Returns the primary control info color of the current theme. This is a
* cover method for {@code getCurrentTheme().getPrimaryControlInfo()}.
*
* @return the primary control info color
*
* @see MetalTheme
*/
public static ColorUIResource getPrimaryControlInfo() { return getCurrentTheme().getPrimaryControlInfo(); }
/**
* Returns the primary control highlight color of the current
* theme. This is a cover method for {@code
* getCurrentTheme().getPrimaryControlHighlight()}.
*
* @return the primary control highlight color
*
* @see MetalTheme
*/
public static ColorUIResource getPrimaryControlHighlight() { return getCurrentTheme().getPrimaryControlHighlight(); }
/**
* Returns the system text color of the current theme. This is a
* cover method for {@code getCurrentTheme().getSystemTextColor()}.
*
* @return the system text color
*
* @see MetalTheme
*/
public static ColorUIResource getSystemTextColor() { return getCurrentTheme().getSystemTextColor(); }
/**
* Returns the control text color of the current theme. This is a
* cover method for {@code getCurrentTheme().getControlTextColor()}.
*
* @return the control text color
*
* @see MetalTheme
*/
public static ColorUIResource getControlTextColor() { return getCurrentTheme().getControlTextColor(); }
/**
* Returns the inactive control text color of the current theme. This is a
* cover method for {@code
* getCurrentTheme().getInactiveControlTextColor()}.
*
* @return the inactive control text color
*
* @see MetalTheme
*/
public static ColorUIResource getInactiveControlTextColor() { return getCurrentTheme().getInactiveControlTextColor(); }
/**
* Returns the inactive system text color of the current theme. This is a
* cover method for {@code
* getCurrentTheme().getInactiveSystemTextColor()}.
*
* @return the inactive system text color
*
* @see MetalTheme
*/
public static ColorUIResource getInactiveSystemTextColor() { return getCurrentTheme().getInactiveSystemTextColor(); }
/**
* Returns the user text color of the current theme. This is a
* cover method for {@code getCurrentTheme().getUserTextColor()}.
*
* @return the user text color
*
* @see MetalTheme
*/
/**
* Returns the text highlight color of the current theme. This is a
* cover method for {@code getCurrentTheme().getTextHighlightColor()}.
*
* @return the text highlight color
*
* @see MetalTheme
*/
public static ColorUIResource getTextHighlightColor() { return getCurrentTheme().getTextHighlightColor(); }
/**
* Returns the highlighted text color of the current theme. This is a
* cover method for {@code getCurrentTheme().getHighlightedTextColor()}.
*
* @return the highlighted text color
*
* @see MetalTheme
*/
public static ColorUIResource getHighlightedTextColor() { return getCurrentTheme().getHighlightedTextColor(); }
/**
* Returns the window background color of the current theme. This is a
* cover method for {@code getCurrentTheme().getWindowBackground()}.
*
* @return the window background color
*
* @see MetalTheme
*/
public static ColorUIResource getWindowBackground() { return getCurrentTheme().getWindowBackground(); }
/**
* Returns the window title background color of the current
* theme. This is a cover method for {@code
* getCurrentTheme().getWindowTitleBackground()}.
*
* @return the window title background color
*
* @see MetalTheme
*/
public static ColorUIResource getWindowTitleBackground() { return getCurrentTheme().getWindowTitleBackground(); }
/**
* Returns the window title foreground color of the current
* theme. This is a cover method for {@code
* getCurrentTheme().getWindowTitleForeground()}.
*
* @return the window title foreground color
*
* @see MetalTheme
*/
public static ColorUIResource getWindowTitleForeground() { return getCurrentTheme().getWindowTitleForeground(); }
/**
* Returns the window title inactive background color of the current
* theme. This is a cover method for {@code
* getCurrentTheme().getWindowTitleInactiveBackground()}.
*
* @return the window title inactive background color
*
* @see MetalTheme
*/
public static ColorUIResource getWindowTitleInactiveBackground() { return getCurrentTheme().getWindowTitleInactiveBackground(); }
/**
* Returns the window title inactive foreground color of the current
* theme. This is a cover method for {@code
* getCurrentTheme().getWindowTitleInactiveForeground()}.
*
* @return the window title inactive foreground color
*
* @see MetalTheme
*/
public static ColorUIResource getWindowTitleInactiveForeground() { return getCurrentTheme().getWindowTitleInactiveForeground(); }
/**
* Returns the menu background color of the current theme. This is
* a cover method for {@code getCurrentTheme().getMenuBackground()}.
*
* @return the menu background color
*
* @see MetalTheme
*/
/**
* Returns the menu foreground color of the current theme. This is
* a cover method for {@code getCurrentTheme().getMenuForeground()}.
*
* @return the menu foreground color
*
* @see MetalTheme
*/
/**
* Returns the menu selected background color of the current theme. This is
* a cover method for
* {@code getCurrentTheme().getMenuSelectedBackground()}.
*
* @return the menu selected background color
*
* @see MetalTheme
*/
public static ColorUIResource getMenuSelectedBackground() { return getCurrentTheme().getMenuSelectedBackground(); }
/**
* Returns the menu selected foreground color of the current theme. This is
* a cover method for
* {@code getCurrentTheme().getMenuSelectedForeground()}.
*
* @return the menu selected foreground color
*
* @see MetalTheme
*/
public static ColorUIResource getMenuSelectedForeground() { return getCurrentTheme().getMenuSelectedForeground(); }
/**
* Returns the menu disabled foreground color of the current theme. This is
* a cover method for
* {@code getCurrentTheme().getMenuDisabledForeground()}.
*
* @return the menu disabled foreground color
*
* @see MetalTheme
*/
public static ColorUIResource getMenuDisabledForeground() { return getCurrentTheme().getMenuDisabledForeground(); }
/**
* Returns the separator background color of the current theme. This is
* a cover method for {@code getCurrentTheme().getSeparatorBackground()}.
*
* @return the separator background color
*
* @see MetalTheme
*/
public static ColorUIResource getSeparatorBackground() { return getCurrentTheme().getSeparatorBackground(); }
/**
* Returns the separator foreground color of the current theme. This is
* a cover method for {@code getCurrentTheme().getSeparatorForeground()}.
*
* @return the separator foreground color
*
* @see MetalTheme
*/
public static ColorUIResource getSeparatorForeground() { return getCurrentTheme().getSeparatorForeground(); }
/**
* Returns the accelerator foreground color of the current theme. This is
* a cover method for {@code getCurrentTheme().getAcceleratorForeground()}.
*
* @return the separator accelerator foreground color
*
* @see MetalTheme
*/
public static ColorUIResource getAcceleratorForeground() { return getCurrentTheme().getAcceleratorForeground(); }
/**
* Returns the accelerator selected foreground color of the
* current theme. This is a cover method for {@code
* getCurrentTheme().getAcceleratorSelectedForeground()}.
*
* @return the accelerator selected foreground color
*
* @see MetalTheme
*/
public static ColorUIResource getAcceleratorSelectedForeground() { return getCurrentTheme().getAcceleratorSelectedForeground(); }
/**
* Returns a {@code LayoutStyle} implementing the Java look and feel
* design guidelines as specified at
* <a href="http://java.sun.com/products/jlf/ed2/book/HIG.Visual2.html">http://java.sun.com/products/jlf/ed2/book/HIG.Visual2.html</a>.
*
* @return LayoutStyle implementing the Java look and feel design
* guidelines
* @since 1.6
*/
return MetalLayoutStyle.INSTANCE;
}
/**
* MetalLazyValue is a slimmed down version of <code>ProxyLaxyValue</code>.
* The code is duplicate so that it can get at the package private
* classes in metal.
*/
/**
* Name of the class to create.
*/
}
this(name);
this.methodName = methodName;
}
try {
if (methodName == null) {
return c.newInstance();
}
new PrivilegedAction<Method>() {
counter--) {
}
}
return null;
}
});
}
} catch (ClassNotFoundException cnfe) {
} catch (InstantiationException ie) {
} catch (IllegalAccessException iae) {
} catch (InvocationTargetException ite) {
}
return null;
}
}
/**
* FontActiveValue redirects to the appropriate metal theme method.
*/
private int type;
}
switch (type) {
case MetalTheme.CONTROL_TEXT_FONT:
break;
case MetalTheme.SYSTEM_TEXT_FONT:
break;
case MetalTheme.USER_TEXT_FONT:
break;
case MetalTheme.MENU_TEXT_FONT:
break;
case MetalTheme.WINDOW_TITLE_FONT:
break;
case MetalTheme.SUB_TEXT_FONT:
break;
}
return value;
}
}
static void flushUnreferenced() {
}
}
static class AATextListener
}
dispose();
return;
}
updateUI();
}
void dispose() {
}
/**
* Updates the UI of the passed in window and all its children.
*/
updateWindowUI(w);
}
}
/**
* Updates the UIs of all the known Frames.
*/
private static void updateAllUIs() {
}
}
/**
* Indicates if an updateUI call is pending.
*/
private static boolean updatePending;
/**
* Sets whether or not an updateUI call is pending.
*/
}
/**
* Returns true if a UI update is pending.
*/
private static synchronized boolean isUpdatePending() {
return updatePending;
}
protected void updateUI() {
if (!isUpdatePending()) {
setUpdatePending(true);
public void run() {
updateAllUIs();
setUpdatePending(false);
}
};
}
}
}
// From the JLF Design Guidelines:
// Checks args
parent);
int offset = 0;
switch(type) {
case INDENT:
// Metal doesn't spec this.
if (indent > 0) {
return indent;
}
return 12;
}
// Fall through to related.
case RELATED:
getModel();
getModel();
if ((sourceModel instanceof DefaultButtonModel) &&
(targetModel instanceof DefaultButtonModel) &&
// When toggle buttons are exclusive (that is,
// they form a radio button set), separate
// them with 2 pixels. This rule applies
// whether the toggle buttons appear in a
// toolbar or elsewhere in the interface.
// Note: this number does not appear to
// include any borders and so is not adjusted
// by the border of the toggle button
return 2;
}
// When toggle buttons are independent (like
// checkboxes) and used outside a toolbar,
// separate them with 5 pixels.
if (usingOcean()) {
return 6;
}
return 5;
}
offset = 6;
break;
case UNRELATED:
offset = 12;
break;
}
// Insert 12 pixels between the trailing edge of a
// label and any associated components. Insert 12
// pixels between the trailing edge of a label and the
// component it describes when labels are
// right-aligned. When labels are left-aligned, insert
// 12 pixels between the trailing edge of the longest
// label and its associated component
offset + 6);
}
}
// Include 11 pixels between the bottom and right
// borders of a dialog box and its command
// buttons. (To the eye, the 11-pixel spacing appears
// to be 12 pixels because the white borders on the
// lower and right edges of the button components are
// not visually significant.)
// NOTE: this last text was designed with Steel in mind,
// not Ocean.
//
// Insert 12 pixels between the edges of the panel and the
// titled border. Insert 11 pixels between the top of the
// title and the component above the titled border. Insert 12
// pixels between the bottom of the title and the top of the
// first label in the panel. Insert 11 pixels between
// component groups and between the bottom of the last
// component and the lower border.
}
if (offset > 0) {
if (buttonAdjustment == 0) {
}
}
if (offset < 0) {
return 0;
}
return offset;
}
return 1;
}
}
}
!usingOcean()) {
return 1;
}
}
return 0;
}
}
}