1 /*
   2  * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.apple.laf;
  27 
  28 import java.awt.*;
  29 import java.security.PrivilegedAction;
  30 import java.util.*;
  31 
  32 import javax.swing.*;
  33 import javax.swing.border.Border;
  34 import javax.swing.plaf.*;
  35 import javax.swing.plaf.basic.BasicLookAndFeel;
  36 
  37 import sun.swing.*;
  38 import apple.laf.*;
  39 
  40 import com.apple.resources.MacOSXResourceBundle;
  41 
  42 public class AquaLookAndFeel extends BasicLookAndFeel {
  43     static final String sOldPropertyPrefix = "com.apple.macos."; // old prefix for things like 'useScreenMenuBar'
  44     static final String sPropertyPrefix = "apple.laf."; // new prefix for things like 'useScreenMenuBar'
  45 
  46     // for lazy initalizers. Following the pattern from metal.
  47     private static final String PKG_PREFIX = "com.apple.laf.";
  48     private static final String kAquaImageFactoryName = PKG_PREFIX + "AquaImageFactory";
  49     private static final String kAquaFontsName = PKG_PREFIX + "AquaFonts";
  50 
  51     /**
  52      * Return a short string that identifies this look and feel, e.g.
  53      * "CDE/Motif".  This string should be appropriate for a menu item.
  54      * Distinct look and feels should have different names, e.g.
  55      * a subclass of MotifLookAndFeel that changes the way a few components
  56      * are rendered should be called "CDE/Motif My Way"; something
  57      * that would be useful to a user trying to select a L&F from a list
  58      * of names.
  59      */
  60     public String getName() {
  61         return "Mac OS X";
  62     }
  63 
  64     /**
  65      * Return a string that identifies this look and feel.  This string
  66      * will be used by applications/services that want to recognize
  67      * well known look and feel implementations.  Presently
  68      * the well known names are "Motif", "Windows", "Mac", "Metal".  Note
  69      * that a LookAndFeel derived from a well known superclass
  70      * that doesn't make any fundamental changes to the look or feel
  71      * shouldn't override this method.
  72      */
  73     public String getID() {
  74         return "Aqua";
  75     }
  76 
  77     /**
  78      * Return a one line description of this look and feel implementation,
  79      * e.g. "The CDE/Motif Look and Feel".   This string is intended for
  80      * the user, e.g. in the title of a window or in a ToolTip message.
  81      */
  82     public String getDescription() {
  83         return "Aqua Look and Feel for Mac OS X";
  84     }
  85 
  86     /**
  87      * Returns true if the <code>LookAndFeel</code> returned
  88      * <code>RootPaneUI</code> instances support providing Window decorations
  89      * in a <code>JRootPane</code>.
  90      * <p>
  91      * The default implementation returns false, subclasses that support
  92      * Window decorations should override this and return true.
  93      *
  94      * @return True if the RootPaneUI instances created support client side
  95      *             decorations
  96      * @see JDialog#setDefaultLookAndFeelDecorated
  97      * @see JFrame#setDefaultLookAndFeelDecorated
  98      * @see JRootPane#setWindowDecorationStyle
  99      * @since 1.4
 100      */
 101     public boolean getSupportsWindowDecorations() {
 102         return false;
 103     }
 104 
 105     /**
 106      * If the underlying platform has a "native" look and feel, and this
 107      * is an implementation of it, return true.
 108      */
 109     public boolean isNativeLookAndFeel() {
 110         return true;
 111     }
 112 
 113     /**
 114      * Return true if the underlying platform supports and or permits
 115      * this look and feel.  This method returns false if the look
 116      * and feel depends on special resources or legal agreements that
 117      * aren't defined for the current platform.
 118      *
 119      * @see UIManager#setLookAndFeel
 120      */
 121     public boolean isSupportedLookAndFeel() {
 122         return true;
 123     }
 124 
 125     /**
 126      * UIManager.setLookAndFeel calls this method before the first
 127      * call (and typically the only call) to getDefaults().  Subclasses
 128      * should do any one-time setup they need here, rather than
 129      * in a static initializer, because look and feel class objects
 130      * may be loaded just to discover that isSupportedLookAndFeel()
 131      * returns false.
 132      *
 133      * @see #uninitialize
 134      * @see UIManager#setLookAndFeel
 135      */
 136     public void initialize() {
 137         java.security.AccessController.doPrivileged(new PrivilegedAction<Void>() {
 138                 public Void run() {
 139                     System.loadLibrary("osxui");
 140                     return null;
 141                 }
 142             });
 143 
 144         java.security.AccessController.doPrivileged(new PrivilegedAction<Void>(){
 145             @Override
 146             public Void run() {
 147                 JRSUIControl.initJRSUI();
 148                 return null;
 149             }
 150         });
 151 
 152         super.initialize();
 153         final ScreenPopupFactory spf = new ScreenPopupFactory();
 154         spf.setActive(true);
 155         PopupFactory.setSharedInstance(spf);
 156 
 157         KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventPostProcessor(AquaMnemonicHandler.getInstance());
 158     }
 159 
 160     /**
 161      * UIManager.setLookAndFeel calls this method just before we're
 162      * replaced by a new default look and feel.   Subclasses may
 163      * choose to free up some resources here.
 164      *
 165      * @see #initialize
 166      */
 167     public void uninitialize() {
 168         KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventPostProcessor(AquaMnemonicHandler.getInstance());
 169 
 170         final PopupFactory popupFactory = PopupFactory.getSharedInstance();
 171         if (popupFactory != null && popupFactory instanceof ScreenPopupFactory) {
 172             ((ScreenPopupFactory)popupFactory).setActive(false);
 173         }
 174 
 175         super.uninitialize();
 176     }
 177 
 178     /**
 179      * Returns an <code>ActionMap</code>.
 180      * <P>
 181      * This <code>ActionMap</code> contains <code>Actions</code> that
 182      * embody the ability to render an auditory cue. These auditory
 183      * cues map onto user and system activities that may be useful
 184      * for an end user to know about (such as a dialog box appearing).
 185      * <P>
 186      * At the appropriate time in a <code>JComponent</code> UI's lifecycle,
 187      * the ComponentUI is responsible for getting the appropriate
 188      * <code>Action</code> out of the <code>ActionMap</code> and passing
 189      * it on to <code>playSound</code>.
 190      * <P>
 191      * The <code>Actions</code> in this <code>ActionMap</code> are
 192      * created by the <code>createAudioAction</code> method.
 193      *
 194      * @return      an ActionMap containing Actions
 195      *              responsible for rendering auditory cues
 196      * @see #createAudioAction
 197      * @see #playSound(Action)
 198      * @since 1.4
 199      */
 200     protected ActionMap getAudioActionMap() {
 201         ActionMap audioActionMap = (ActionMap)UIManager.get("AuditoryCues.actionMap");
 202         if (audioActionMap != null) return audioActionMap;
 203 
 204         final Object[] acList = (Object[])UIManager.get("AuditoryCues.cueList");
 205         if (acList != null) {
 206             audioActionMap = new ActionMapUIResource();
 207             for (int counter = acList.length - 1; counter >= 0; counter--) {
 208                 audioActionMap.put(acList[counter], createAudioAction(acList[counter]));
 209             }
 210         }
 211         UIManager.getLookAndFeelDefaults().put("AuditoryCues.actionMap", audioActionMap);
 212 
 213         return audioActionMap;
 214     }
 215 
 216     /**
 217      * We override getDefaults() so we can install our own debug defaults
 218      * if needed for testing
 219      */
 220     public UIDefaults getDefaults() {
 221         final UIDefaults table = new UIDefaults();
 222         // use debug defaults if you want to see every query into the defaults object.
 223         //UIDefaults table = new DebugDefaults();
 224         try {
 225             // PopupFactory.getSharedInstance().setPopupType(2);
 226             initClassDefaults(table);
 227 
 228             // Here we install all the Basic defaults in case we missed some in our System color
 229             // or component defaults that follow. Eventually we will take this out.
 230             // This is a big negative to performance so we want to get it out as soon
 231             // as we are comfortable with the Aqua defaults.
 232             super.initSystemColorDefaults(table);
 233             super.initComponentDefaults(table);
 234 
 235             // Because the last elements added win in precedence we add all of our aqua elements here.
 236             initSystemColorDefaults(table);
 237             initComponentDefaults(table);
 238         } catch(final Exception e) {
 239             e.printStackTrace();
 240         }
 241         return table;
 242     }
 243 
 244     /**
 245      * Initialize the defaults table with the name of the ResourceBundle
 246      * used for getting localized defaults.  Also initialize the default
 247      * locale used when no locale is passed into UIDefaults.get().  The
 248      * default locale should generally not be relied upon. It is here for
 249      * compatability with releases prior to 1.4.
 250      */
 251     private void initResourceBundle(final UIDefaults table) {
 252         table.setDefaultLocale(Locale.getDefault());
 253         try {
 254             final ResourceBundle aquaProperties = MacOSXResourceBundle.getMacResourceBundle(PKG_PREFIX + "resources.aqua");
 255             final Enumeration<String> propertyKeys = aquaProperties.getKeys();
 256 
 257             while (propertyKeys.hasMoreElements()) {
 258                 final String key = propertyKeys.nextElement();
 259                 table.put(key, aquaProperties.getString(key));
 260             }
 261         } catch (final Exception e) {
 262             table.addResourceBundle(PKG_PREFIX + "resources.aqua");
 263         }
 264     }
 265 
 266     /**
 267      * This is the last step in the getDefaults routine usually called from our superclass
 268      */
 269     protected void initComponentDefaults(final UIDefaults table) {
 270         initResourceBundle(table);
 271 
 272         final InsetsUIResource zeroInsets = new InsetsUIResource(0, 0, 0, 0);
 273         final InsetsUIResource menuItemMargin = zeroInsets;
 274 
 275         // <rdar://problem/5189013> Entire Java application window refreshes when moving off Shortcut menu item
 276         final Boolean useOpaqueComponents = Boolean.TRUE;
 277 
 278         final Boolean buttonShouldBeOpaque = AquaUtils.shouldUseOpaqueButtons() ? Boolean.TRUE : Boolean.FALSE;
 279 
 280         // *** List value objects
 281         final Object listCellRendererActiveValue = new UIDefaults.ActiveValue(){
 282             public Object createValue(UIDefaults defaultsTable) {
 283                 return new DefaultListCellRenderer.UIResource();
 284             }
 285         };
 286 
 287         // SJA - I'm basing this on what is in the MetalLookAndFeel class, but
 288         // without being based on BasicLookAndFeel. We want more flexibility.
 289         // The key to doing this well is to use Lazy initializing classes as
 290         // much as possible.
 291 
 292         // Here I want to go to native and get all the values we'd need for colors etc.
 293         final Border toolTipBorder = new BorderUIResource.EmptyBorderUIResource(2, 0, 2, 0);
 294         final ColorUIResource toolTipBackground = new ColorUIResource(255, 255, (int)(255.0 * 0.80));
 295         final ColorUIResource black = new ColorUIResource(Color.black);
 296         final ColorUIResource white = new ColorUIResource(Color.white);
 297         final ColorUIResource smokyGlass = new ColorUIResource(new Color(0, 0, 0, 152));
 298         final ColorUIResource dockIconRim = new ColorUIResource(new Color(192, 192, 192, 192));
 299         final ColorUIResource mediumTranslucentBlack = new ColorUIResource(new Color(0, 0, 0, 100));
 300         final ColorUIResource translucentWhite = new ColorUIResource(new Color(255, 255, 255, 254));
 301     //    final ColorUIResource lightGray = new ColorUIResource(232, 232, 232);
 302         final ColorUIResource disabled = new ColorUIResource(0.5f, 0.5f, 0.5f);
 303         final ColorUIResource disabledShadow = new ColorUIResource(0.25f, 0.25f, 0.25f);
 304         final ColorUIResource selected = new ColorUIResource(1.0f, 0.4f, 0.4f);
 305 
 306         // Contrast tab UI colors
 307 
 308         final ColorUIResource selectedTabTitlePressedColor = new ColorUIResource(240, 240, 240);
 309         final ColorUIResource selectedTabTitleDisabledColor = new ColorUIResource(new Color(1, 1, 1, 0.55f));
 310         final ColorUIResource selectedTabTitleNormalColor = white;
 311         final ColorUIResource selectedTabTitleShadowDisabledColor = new ColorUIResource(new Color(0, 0, 0, 0.25f));
 312         final ColorUIResource selectedTabTitleShadowNormalColor = mediumTranslucentBlack;
 313         final ColorUIResource nonSelectedTabTitleNormalColor = black;
 314 
 315         final ColorUIResource toolbarDragHandleColor = new ColorUIResource(140, 140, 140);
 316 
 317         // sja todo Make these lazy values so we only get them when required - if we deem it necessary
 318         // it may be the case that we think the overhead of a proxy lazy value is not worth delaying
 319         // creating the object if we think that most swing apps will use this.
 320         // the lazy value is useful for delaying initialization until this default value is actually
 321         // accessed by the LAF instead of at init time, so making it lazy should speed up
 322         // our launch times of Swing apps.
 323 
 324         // *** Text value objects
 325         final Object marginBorder = new SwingLazyValue("javax.swing.plaf.basic.BasicBorders$MarginBorder");
 326 
 327         final Object zero = new Integer(0);
 328         final Object editorMargin = zeroInsets; // this is not correct - look at TextEdit to determine the right margin
 329         final Object textCaretBlinkRate = new Integer(500);
 330         final Object textFieldBorder = new SwingLazyValue(PKG_PREFIX + "AquaTextFieldBorder", "getTextFieldBorder");
 331         final Object textAreaBorder = marginBorder; // text areas have no real border - radar 311073
 332 
 333         final Object scollListBorder = new SwingLazyValue(PKG_PREFIX + "AquaScrollRegionBorder", "getScrollRegionBorder");
 334         final Object aquaTitledBorder = new SwingLazyValue(PKG_PREFIX + "AquaGroupBorder", "getBorderForTitledBorder");
 335         final Object aquaInsetBorder = new SwingLazyValue(PKG_PREFIX + "AquaGroupBorder", "getTitlelessBorder");
 336 
 337         final Border listHeaderBorder = AquaTableHeaderBorder.getListHeaderBorder();
 338         final Border zeroBorder = new BorderUIResource.EmptyBorderUIResource(0, 0, 0, 0);
 339 
 340         // we can't seem to proxy Colors
 341         final Color selectionBackground = AquaImageFactory.getSelectionBackgroundColorUIResource();
 342         final Color selectionForeground = AquaImageFactory.getSelectionForegroundColorUIResource();
 343         final Color selectionInactiveBackground = AquaImageFactory.getSelectionInactiveBackgroundColorUIResource();
 344         final Color selectionInactiveForeground = AquaImageFactory.getSelectionInactiveForegroundColorUIResource();
 345 
 346         final Color textHighlightText = AquaImageFactory.getTextSelectionForegroundColorUIResource();
 347         final Color textHighlight = AquaImageFactory.getTextSelectionBackgroundColorUIResource();
 348         final Color textHighlightInactive = new ColorUIResource(212, 212, 212);
 349 
 350         final Color textInactiveText = disabled;
 351         final Color textForeground = black;
 352         final Color textBackground = white;
 353         final Color textInactiveBackground = white;
 354 
 355         final Color textPasswordFieldCapsLockIconColor = mediumTranslucentBlack;
 356 
 357         final Object internalFrameBorder = new SwingLazyValue("javax.swing.plaf.basic.BasicBorders", "getInternalFrameBorder");
 358         final Color desktopBackgroundColor = new ColorUIResource(new Color(65, 105, 170));//SystemColor.desktop
 359 
 360         final Color focusRingColor = AquaImageFactory.getFocusRingColorUIResource();
 361         final Border focusCellHighlightBorder = new BorderUIResource.LineBorderUIResource(focusRingColor);
 362 
 363         final Color windowBackgroundColor = AquaImageFactory.getWindowBackgroundColorUIResource();
 364         final Color panelBackgroundColor = windowBackgroundColor;
 365         final Color tabBackgroundColor = windowBackgroundColor;
 366         final Color controlBackgroundColor = windowBackgroundColor;
 367 
 368         final Object controlFont = new SwingLazyValue(kAquaFontsName, "getControlTextFont");
 369         final Object controlSmallFont = new SwingLazyValue(kAquaFontsName, "getControlTextSmallFont");
 370         final Object alertHeaderFont = new SwingLazyValue(kAquaFontsName, "getAlertHeaderFont");
 371         final Object menuFont = new SwingLazyValue(kAquaFontsName, "getMenuFont");
 372         final Object viewFont = new SwingLazyValue(kAquaFontsName, "getViewFont");
 373 
 374         final Color menuBackgroundColor = new ColorUIResource(Color.white);
 375         final Color menuForegroundColor = black;
 376 
 377         final Color menuSelectedForegroundColor = white;
 378         final Color menuSelectedBackgroundColor = focusRingColor;
 379 
 380         final Color menuDisabledBackgroundColor = menuBackgroundColor;
 381         final Color menuDisabledForegroundColor = disabled;
 382 
 383         final Color menuAccelForegroundColor = black;
 384         final Color menuAccelSelectionForegroundColor = black;
 385 
 386         final Border menuBorder = new AquaMenuBorder();
 387 
 388         final UIDefaults.LazyInputMap controlFocusInputMap = new UIDefaults.LazyInputMap(new Object[]{
 389             "SPACE", "pressed",
 390             "released SPACE", "released"
 391         });
 392 
 393         // sja testing
 394         final Object confirmIcon = new SwingLazyValue(kAquaImageFactoryName, "getConfirmImageIcon"); // AquaImageFactory.getConfirmImageIcon();
 395         final Object cautionIcon = new SwingLazyValue(kAquaImageFactoryName, "getCautionImageIcon"); // AquaImageFactory.getCautionImageIcon();
 396         final Object stopIcon = new SwingLazyValue(kAquaImageFactoryName, "getStopImageIcon"); // AquaImageFactory.getStopImageIcon();
 397         final Object securityIcon = new SwingLazyValue(kAquaImageFactoryName, "getLockImageIcon"); // AquaImageFactory.getLockImageIcon();
 398 
 399         final AquaKeyBindings aquaKeyBindings = AquaKeyBindings.instance();
 400 
 401         final Object[] defaults = {
 402             "control", windowBackgroundColor, /* Default color for controls (buttons, sliders, etc) */
 403 
 404             // Buttons
 405             "Button.background", controlBackgroundColor,
 406             "Button.foreground", black,
 407             "Button.disabledText", disabled,
 408             "Button.select", selected,
 409             "Button.border", new SwingLazyValue(PKG_PREFIX + "AquaButtonBorder", "getDynamicButtonBorder"),
 410             "Button.font", controlFont,
 411             "Button.textIconGap", new Integer(4),
 412             "Button.textShiftOffset", zero, // radar 3308129 - aqua doesn't move images when pressed.
 413             "Button.focusInputMap", controlFocusInputMap,
 414             "Button.margin", new InsetsUIResource(0, 2, 0, 2),
 415             "Button.opaque", buttonShouldBeOpaque,
 416 
 417             "CheckBox.background", controlBackgroundColor,
 418             "CheckBox.foreground", black,
 419             "CheckBox.disabledText", disabled,
 420             "CheckBox.select", selected,
 421             "CheckBox.icon", new SwingLazyValue(PKG_PREFIX + "AquaButtonCheckBoxUI", "getSizingCheckBoxIcon"),
 422             "CheckBox.font", controlFont,
 423             "CheckBox.border", AquaButtonBorder.getBevelButtonBorder(),
 424             "CheckBox.margin", new InsetsUIResource(1, 1, 0, 1),
 425             // radar 3583849. This property never gets
 426             // used. The border for the Checkbox gets overridden
 427             // by AquaRadiButtonUI.setThemeBorder(). Needs refactoring. (vm)
 428             // why is button focus commented out?
 429             //"CheckBox.focus", getFocusColor(),
 430             "CheckBox.focusInputMap", controlFocusInputMap,
 431 
 432             "CheckBoxMenuItem.font", menuFont,
 433             "CheckBoxMenuItem.acceleratorFont", menuFont,
 434             "CheckBoxMenuItem.background", menuBackgroundColor,
 435             "CheckBoxMenuItem.foreground", menuForegroundColor,
 436             "CheckBoxMenuItem.selectionBackground", menuSelectedBackgroundColor,
 437             "CheckBoxMenuItem.selectionForeground", menuSelectedForegroundColor,
 438             "CheckBoxMenuItem.disabledBackground", menuDisabledBackgroundColor,
 439             "CheckBoxMenuItem.disabledForeground", menuDisabledForegroundColor,
 440             "CheckBoxMenuItem.acceleratorForeground", menuAccelForegroundColor,
 441             "CheckBoxMenuItem.acceleratorSelectionForeground", menuAccelSelectionForegroundColor,
 442             "CheckBoxMenuItem.acceleratorDelimiter", "",
 443             "CheckBoxMenuItem.border", menuBorder, // for inset calculation
 444             "CheckBoxMenuItem.margin", menuItemMargin,
 445             "CheckBoxMenuItem.borderPainted", Boolean.TRUE,
 446             "CheckBoxMenuItem.checkIcon", new SwingLazyValue(kAquaImageFactoryName, "getMenuItemCheckIcon"),
 447             "CheckBoxMenuItem.dashIcon", new SwingLazyValue(kAquaImageFactoryName, "getMenuItemDashIcon"),
 448             //"CheckBoxMenuItem.arrowIcon", null,
 449 
 450             "ColorChooser.background", panelBackgroundColor,
 451 
 452             // *** ComboBox
 453             "ComboBox.font", controlFont,
 454             "ComboBox.background", controlBackgroundColor, //menuBackgroundColor, // "menu" when it has no scrollbar, "listView" when it does
 455             "ComboBox.foreground", menuForegroundColor,
 456             "ComboBox.selectionBackground", menuSelectedBackgroundColor,
 457             "ComboBox.selectionForeground", menuSelectedForegroundColor,
 458             "ComboBox.disabledBackground", menuDisabledBackgroundColor,
 459             "ComboBox.disabledForeground", menuDisabledForegroundColor,
 460             "ComboBox.ancestorInputMap", aquaKeyBindings.getComboBoxInputMap(),
 461 
 462             "DesktopIcon.border", internalFrameBorder,
 463             "DesktopIcon.borderColor", smokyGlass,
 464             "DesktopIcon.borderRimColor", dockIconRim,
 465             "DesktopIcon.labelBackground", mediumTranslucentBlack,
 466             "Desktop.background", desktopBackgroundColor,
 467 
 468             "EditorPane.focusInputMap", aquaKeyBindings.getMultiLineTextInputMap(),
 469             "EditorPane.font", controlFont,
 470             "EditorPane.background", textBackground,
 471             "EditorPane.foreground", textForeground,
 472             "EditorPane.selectionBackground", textHighlight,
 473             "EditorPane.selectionForeground", textHighlightText,
 474             "EditorPane.caretForeground", textForeground,
 475             "EditorPane.caretBlinkRate", textCaretBlinkRate,
 476             "EditorPane.inactiveForeground", textInactiveText,
 477             "EditorPane.inactiveBackground", textInactiveBackground,
 478             "EditorPane.border", textAreaBorder,
 479             "EditorPane.margin", editorMargin,
 480 
 481             "FileChooser.newFolderIcon", AquaIcon.SystemIcon.getFolderIconUIResource(),
 482             "FileChooser.upFolderIcon", AquaIcon.SystemIcon.getFolderIconUIResource(),
 483             "FileChooser.homeFolderIcon", AquaIcon.SystemIcon.getDesktopIconUIResource(),
 484             "FileChooser.detailsViewIcon", AquaIcon.SystemIcon.getComputerIconUIResource(),
 485             "FileChooser.listViewIcon", AquaIcon.SystemIcon.getComputerIconUIResource(),
 486 
 487             "FileView.directoryIcon", AquaIcon.SystemIcon.getFolderIconUIResource(),
 488             "FileView.fileIcon", AquaIcon.SystemIcon.getDocumentIconUIResource(),
 489             "FileView.computerIcon", AquaIcon.SystemIcon.getDesktopIconUIResource(),
 490             "FileView.hardDriveIcon", AquaIcon.SystemIcon.getHardDriveIconUIResource(),
 491             "FileView.floppyDriveIcon", AquaIcon.SystemIcon.getFloppyIconUIResource(),
 492 
 493             // File View
 494             "FileChooser.cancelButtonMnemonic", zero,
 495             "FileChooser.saveButtonMnemonic", zero,
 496             "FileChooser.openButtonMnemonic", zero,
 497             "FileChooser.updateButtonMnemonic", zero,
 498             "FileChooser.helpButtonMnemonic", zero,
 499             "FileChooser.directoryOpenButtonMnemonic", zero,
 500 
 501             "FileChooser.lookInLabelMnemonic", zero,
 502             "FileChooser.fileNameLabelMnemonic", zero,
 503             "FileChooser.filesOfTypeLabelMnemonic", zero,
 504 
 505             "Focus.color", focusRingColor,
 506 
 507             "FormattedTextField.focusInputMap", aquaKeyBindings.getFormattedTextFieldInputMap(),
 508             "FormattedTextField.font", controlFont,
 509             "FormattedTextField.background", textBackground,
 510             "FormattedTextField.foreground", textForeground,
 511             "FormattedTextField.inactiveForeground", textInactiveText,
 512             "FormattedTextField.inactiveBackground", textInactiveBackground,
 513             "FormattedTextField.selectionBackground", textHighlight,
 514             "FormattedTextField.selectionForeground", textHighlightText,
 515             "FormattedTextField.caretForeground", textForeground,
 516             "FormattedTextField.caretBlinkRate", textCaretBlinkRate,
 517             "FormattedTextField.border", textFieldBorder,
 518             "FormattedTextField.margin", zeroInsets,
 519 
 520             "IconButton.font", controlSmallFont,
 521 
 522             "InternalFrame.titleFont", menuFont,
 523             "InternalFrame.background", windowBackgroundColor,
 524             "InternalFrame.borderColor", windowBackgroundColor,
 525             "InternalFrame.borderShadow", Color.red,
 526             "InternalFrame.borderDarkShadow", Color.green,
 527             "InternalFrame.borderHighlight", Color.blue,
 528             "InternalFrame.borderLight", Color.yellow,
 529             "InternalFrame.opaque", Boolean.FALSE,
 530             "InternalFrame.border", null, //internalFrameBorder,
 531             "InternalFrame.icon", null,
 532 
 533             "InternalFrame.paletteBorder", null,//internalFrameBorder,
 534             "InternalFrame.paletteTitleFont", menuFont,
 535             "InternalFrame.paletteBackground", windowBackgroundColor,
 536 
 537             "InternalFrame.optionDialogBorder", null,//internalFrameBorder,
 538             "InternalFrame.optionDialogTitleFont", menuFont,
 539             "InternalFrame.optionDialogBackground", windowBackgroundColor,
 540 
 541             /* Default frame icons are undefined for Basic. */
 542 
 543             "InternalFrame.closeIcon", new SwingLazyValue(PKG_PREFIX + "AquaInternalFrameUI", "exportCloseIcon"),
 544             "InternalFrame.maximizeIcon", new SwingLazyValue(PKG_PREFIX + "AquaInternalFrameUI", "exportZoomIcon"),
 545             "InternalFrame.iconifyIcon", new SwingLazyValue(PKG_PREFIX + "AquaInternalFrameUI", "exportMinimizeIcon"),
 546             "InternalFrame.minimizeIcon", new SwingLazyValue(PKG_PREFIX + "AquaInternalFrameUI", "exportMinimizeIcon"),
 547             // this could be either grow or icon
 548             // we decided to make it icon so that anyone who uses
 549             // these for ui will have different icons for max and min
 550             // these icons are pretty crappy to use in Mac OS X since
 551             // they really are interactive but we have to return a static
 552             // icon for now.
 553 
 554             // InternalFrame Auditory Cue Mappings
 555             "InternalFrame.closeSound", null,
 556             "InternalFrame.maximizeSound", null,
 557             "InternalFrame.minimizeSound", null,
 558             "InternalFrame.restoreDownSound", null,
 559             "InternalFrame.restoreUpSound", null,
 560 
 561             "InternalFrame.activeTitleBackground", windowBackgroundColor,
 562             "InternalFrame.activeTitleForeground", textForeground,
 563             "InternalFrame.inactiveTitleBackground", windowBackgroundColor,
 564             "InternalFrame.inactiveTitleForeground", textInactiveText,
 565             "InternalFrame.windowBindings", new Object[]{
 566                 "shift ESCAPE", "showSystemMenu",
 567                 "ctrl SPACE", "showSystemMenu",
 568                 "ESCAPE", "hideSystemMenu"
 569             },
 570 
 571             // Radar [3543438]. We now define the TitledBorder properties for font and color.
 572             // Aqua HIG doesn't define TitledBorders as Swing does. Eventually, we might want to
 573             // re-think TitledBorder to behave more like a Box (NSBox). (vm)
 574             "TitledBorder.font", controlFont,
 575             "TitledBorder.titleColor", black,
 576         //    "TitledBorder.border", -- we inherit this property from BasicLookAndFeel (etched border)
 577             "TitledBorder.aquaVariant", aquaTitledBorder, // this is the border that matches what aqua really looks like
 578             "InsetBorder.aquaVariant", aquaInsetBorder, // this is the title-less variant
 579 
 580             // *** Label
 581             "Label.font", controlFont, // themeLabelFont is for small things like ToolbarButtons
 582             "Label.background", controlBackgroundColor,
 583             "Label.foreground", black,
 584             "Label.disabledForeground", disabled,
 585             "Label.disabledShadow", disabledShadow,
 586             "Label.opaque", useOpaqueComponents,
 587             "Label.border", null,
 588 
 589             "List.font", viewFont, // [3577901] Aqua HIG says "default font of text in lists and tables" should be 12 point (vm).
 590             "List.background", white,
 591             "List.foreground", black,
 592             "List.selectionBackground", selectionBackground,
 593             "List.selectionForeground", selectionForeground,
 594             "List.selectionInactiveBackground", selectionInactiveBackground,
 595             "List.selectionInactiveForeground", selectionInactiveForeground,
 596             "List.focusCellHighlightBorder", focusCellHighlightBorder,
 597             "List.border", null,
 598             "List.cellRenderer", listCellRendererActiveValue,
 599 
 600             "List.sourceListBackgroundPainter", new SwingLazyValue(PKG_PREFIX + "AquaListUI", "getSourceListBackgroundPainter"),
 601             "List.sourceListSelectionBackgroundPainter", new SwingLazyValue(PKG_PREFIX + "AquaListUI", "getSourceListSelectionBackgroundPainter"),
 602             "List.sourceListFocusedSelectionBackgroundPainter", new SwingLazyValue(PKG_PREFIX + "AquaListUI", "getSourceListFocusedSelectionBackgroundPainter"),
 603             "List.evenRowBackgroundPainter", new SwingLazyValue(PKG_PREFIX + "AquaListUI", "getListEvenBackgroundPainter"),
 604             "List.oddRowBackgroundPainter", new SwingLazyValue(PKG_PREFIX + "AquaListUI", "getListOddBackgroundPainter"),
 605 
 606             // <rdar://Problem/3743210> The modifier for the Mac is meta, not control.
 607             "List.focusInputMap", aquaKeyBindings.getListInputMap(),
 608 
 609             //"List.scrollPaneBorder", listBoxBorder, // Not used in Swing1.1
 610             //"ListItem.border", ThemeMenu.listItemBorder(), // for inset calculation
 611 
 612             // *** Menus
 613             "Menu.font", menuFont,
 614             "Menu.acceleratorFont", menuFont,
 615             "Menu.background", menuBackgroundColor,
 616             "Menu.foreground", menuForegroundColor,
 617             "Menu.selectionBackground", menuSelectedBackgroundColor,
 618             "Menu.selectionForeground", menuSelectedForegroundColor,
 619             "Menu.disabledBackground", menuDisabledBackgroundColor,
 620             "Menu.disabledForeground", menuDisabledForegroundColor,
 621             "Menu.acceleratorForeground", menuAccelForegroundColor,
 622             "Menu.acceleratorSelectionForeground", menuAccelSelectionForegroundColor,
 623             //"Menu.border", ThemeMenu.menuItemBorder(), // for inset calculation
 624             "Menu.border", menuBorder,
 625             "Menu.borderPainted", Boolean.FALSE,
 626             "Menu.margin", menuItemMargin,
 627             //"Menu.checkIcon", emptyCheckIcon, // A non-drawing GlyphIcon to make the spacing consistent
 628             "Menu.arrowIcon", new SwingLazyValue(kAquaImageFactoryName, "getMenuArrowIcon"),
 629             "Menu.consumesTabs", Boolean.TRUE,
 630             "Menu.menuPopupOffsetY", new Integer(1),
 631             "Menu.submenuPopupOffsetY", new Integer(-4),
 632 
 633             "MenuBar.font", menuFont,
 634             "MenuBar.background", menuBackgroundColor, // not a menu item, not selected
 635             "MenuBar.foreground", menuForegroundColor,
 636             "MenuBar.border", new AquaMenuBarBorder(), // sja make lazy!
 637             "MenuBar.margin", new InsetsUIResource(0, 8, 0, 8), // sja make lazy!
 638             "MenuBar.selectionBackground", menuSelectedBackgroundColor, // not a menu item, is selected
 639             "MenuBar.selectionForeground", menuSelectedForegroundColor,
 640             "MenuBar.disabledBackground", menuDisabledBackgroundColor, //ThemeBrush.GetThemeBrushForMenu(false, false), // not a menu item, not selected
 641             "MenuBar.disabledForeground", menuDisabledForegroundColor,
 642             "MenuBar.backgroundPainter", new SwingLazyValue(PKG_PREFIX + "AquaMenuPainter", "getMenuBarPainter"),
 643             "MenuBar.selectedBackgroundPainter", new SwingLazyValue(PKG_PREFIX + "AquaMenuPainter", "getSelectedMenuBarItemPainter"),
 644 
 645             "MenuItem.font", menuFont,
 646             "MenuItem.acceleratorFont", menuFont,
 647             "MenuItem.background", menuBackgroundColor,
 648             "MenuItem.foreground", menuForegroundColor,
 649             "MenuItem.selectionBackground", menuSelectedBackgroundColor,
 650             "MenuItem.selectionForeground", menuSelectedForegroundColor,
 651             "MenuItem.disabledBackground", menuDisabledBackgroundColor,
 652             "MenuItem.disabledForeground", menuDisabledForegroundColor,
 653             "MenuItem.acceleratorForeground", menuAccelForegroundColor,
 654             "MenuItem.acceleratorSelectionForeground", menuAccelSelectionForegroundColor,
 655             "MenuItem.acceleratorDelimiter", "",
 656             "MenuItem.border", menuBorder,
 657             "MenuItem.margin", menuItemMargin,
 658             "MenuItem.borderPainted", Boolean.TRUE,
 659             //"MenuItem.checkIcon", emptyCheckIcon, // A non-drawing GlyphIcon to make the spacing consistent
 660             //"MenuItem.arrowIcon", null,
 661             "MenuItem.selectedBackgroundPainter", new SwingLazyValue(PKG_PREFIX + "AquaMenuPainter", "getSelectedMenuItemPainter"),
 662 
 663             // *** OptionPane
 664             // You can additionaly define OptionPane.messageFont which will
 665             // dictate the fonts used for the message, and
 666             // OptionPane.buttonFont, which defines the font for the buttons.
 667             "OptionPane.font", alertHeaderFont,
 668             "OptionPane.messageFont", controlFont,
 669             "OptionPane.buttonFont", controlFont,
 670             "OptionPane.background", windowBackgroundColor,
 671             "OptionPane.foreground", black,
 672             "OptionPane.messageForeground", black,
 673             "OptionPane.border", new BorderUIResource.EmptyBorderUIResource(12, 21, 17, 21),
 674             "OptionPane.messageAreaBorder", zeroBorder,
 675             "OptionPane.buttonAreaBorder", new BorderUIResource.EmptyBorderUIResource(13, 0, 0, 0),
 676             "OptionPane.minimumSize", new DimensionUIResource(262, 90),
 677 
 678             "OptionPane.errorIcon", stopIcon,
 679             "OptionPane.informationIcon", confirmIcon,
 680             "OptionPane.warningIcon", cautionIcon,
 681             "OptionPane.questionIcon", confirmIcon,
 682             "_SecurityDecisionIcon", securityIcon,
 683             "OptionPane.windowBindings", new Object[]{"ESCAPE", "close"},
 684             // OptionPane Auditory Cue Mappings
 685             "OptionPane.errorSound", null,
 686             "OptionPane.informationSound", null, // Info and Plain
 687             "OptionPane.questionSound", null,
 688             "OptionPane.warningSound", null,
 689             "OptionPane.buttonClickThreshhold", new Integer(500),
 690             "OptionPane.yesButtonMnemonic", "",
 691             "OptionPane.noButtonMnemonic", "",
 692             "OptionPane.okButtonMnemonic", "",
 693             "OptionPane.cancelButtonMnemonic", "",
 694 
 695             "Panel.font", controlFont,
 696             "Panel.background", panelBackgroundColor, //new ColorUIResource(0.5647f, 0.9957f, 0.5059f),
 697             "Panel.foreground", black,
 698             "Panel.opaque", useOpaqueComponents,
 699 
 700             "PasswordField.focusInputMap", aquaKeyBindings.getTextFieldInputMap(),
 701             "PasswordField.font", controlFont,
 702             "PasswordField.background", textBackground,
 703             "PasswordField.foreground", textForeground,
 704             "PasswordField.inactiveForeground", textInactiveText,
 705             "PasswordField.inactiveBackground", textInactiveBackground,
 706             "PasswordField.selectionBackground", textHighlight,
 707             "PasswordField.selectionForeground", textHighlightText,
 708             "PasswordField.caretForeground", textForeground,
 709             "PasswordField.caretBlinkRate", textCaretBlinkRate,
 710             "PasswordField.border", textFieldBorder,
 711             "PasswordField.margin", zeroInsets,
 712             "PasswordField.echoChar", new Character((char)0x25CF),
 713             "PasswordField.capsLockIconColor", textPasswordFieldCapsLockIconColor,
 714 
 715             "PopupMenu.font", menuFont,
 716             "PopupMenu.background", menuBackgroundColor,
 717             "PopupMenu.translucentBackground", translucentWhite,
 718             "PopupMenu.foreground", menuForegroundColor,
 719             "PopupMenu.selectionBackground", menuSelectedBackgroundColor,
 720             "PopupMenu.selectionForeground", menuSelectedForegroundColor,
 721             "PopupMenu.border", menuBorder,
 722 //            "PopupMenu.margin",
 723 
 724             "ProgressBar.font", controlFont,
 725             "ProgressBar.foreground", black,
 726             "ProgressBar.background", controlBackgroundColor,
 727             "ProgressBar.selectionForeground", black,
 728             "ProgressBar.selectionBackground", white,
 729             "ProgressBar.border", new BorderUIResource(BorderFactory.createEmptyBorder()),
 730             "ProgressBar.repaintInterval", new Integer(20),
 731 
 732             "RadioButton.background", controlBackgroundColor,
 733             "RadioButton.foreground", black,
 734             "RadioButton.disabledText", disabled,
 735             "RadioButton.select", selected,
 736             "RadioButton.icon", new SwingLazyValue(PKG_PREFIX + "AquaButtonRadioUI", "getSizingRadioButtonIcon"),
 737             "RadioButton.font", controlFont,
 738             "RadioButton.border", AquaButtonBorder.getBevelButtonBorder(),
 739             "RadioButton.margin", new InsetsUIResource(1, 1, 0, 1),
 740             "RadioButton.focusInputMap", controlFocusInputMap,
 741 
 742             "RadioButtonMenuItem.font", menuFont,
 743             "RadioButtonMenuItem.acceleratorFont", menuFont,
 744             "RadioButtonMenuItem.background", menuBackgroundColor,
 745             "RadioButtonMenuItem.foreground", menuForegroundColor,
 746             "RadioButtonMenuItem.selectionBackground", menuSelectedBackgroundColor,
 747             "RadioButtonMenuItem.selectionForeground", menuSelectedForegroundColor,
 748             "RadioButtonMenuItem.disabledBackground", menuDisabledBackgroundColor,
 749             "RadioButtonMenuItem.disabledForeground", menuDisabledForegroundColor,
 750             "RadioButtonMenuItem.acceleratorForeground", menuAccelForegroundColor,
 751             "RadioButtonMenuItem.acceleratorSelectionForeground", menuAccelSelectionForegroundColor,
 752             "RadioButtonMenuItem.acceleratorDelimiter", "",
 753             "RadioButtonMenuItem.border", menuBorder, // for inset calculation
 754             "RadioButtonMenuItem.margin", menuItemMargin,
 755             "RadioButtonMenuItem.borderPainted", Boolean.TRUE,
 756             "RadioButtonMenuItem.checkIcon", new SwingLazyValue(kAquaImageFactoryName, "getMenuItemCheckIcon"),
 757             "RadioButtonMenuItem.dashIcon", new SwingLazyValue(kAquaImageFactoryName, "getMenuItemDashIcon"),
 758             //"RadioButtonMenuItem.arrowIcon", null,
 759 
 760             "Separator.background", null,
 761             "Separator.foreground", new ColorUIResource(0xD4, 0xD4, 0xD4),
 762 
 763             "ScrollBar.border", null,
 764             "ScrollBar.focusInputMap", aquaKeyBindings.getScrollBarInputMap(),
 765             "ScrollBar.focusInputMap.RightToLeft", aquaKeyBindings.getScrollBarRightToLeftInputMap(),
 766             "ScrollBar.width", new Integer(16),
 767             "ScrollBar.background", white,
 768             "ScrollBar.foreground", black,
 769 
 770             "ScrollPane.font", controlFont,
 771             "ScrollPane.background", white,
 772             "ScrollPane.foreground", black, //$
 773             "ScrollPane.border", scollListBorder,
 774             "ScrollPane.viewportBorder", null,
 775 
 776             "ScrollPane.ancestorInputMap", aquaKeyBindings.getScrollPaneInputMap(),
 777             "ScrollPane.ancestorInputMap.RightToLeft", new UIDefaults.LazyInputMap(new Object[]{}),
 778 
 779             "Viewport.font", controlFont,
 780             "Viewport.background", white, // The background for tables, lists, etc
 781             "Viewport.foreground", black,
 782 
 783             // *** Slider
 784             "Slider.foreground", black, "Slider.background", controlBackgroundColor,
 785             "Slider.font", controlSmallFont,
 786             //"Slider.highlight", table.get("controlLtHighlight"),
 787             //"Slider.shadow", table.get("controlShadow"),
 788             //"Slider.focus", table.get("controlDkShadow"),
 789             "Slider.tickColor", new ColorUIResource(Color.GRAY),
 790             "Slider.border", null,
 791             "Slider.focusInsets", new InsetsUIResource(2, 2, 2, 2),
 792             "Slider.focusInputMap", aquaKeyBindings.getSliderInputMap(),
 793             "Slider.focusInputMap.RightToLeft", aquaKeyBindings.getSliderRightToLeftInputMap(),
 794 
 795             // *** Spinner
 796             "Spinner.font", controlFont,
 797             "Spinner.background", controlBackgroundColor,
 798             "Spinner.foreground", black,
 799             "Spinner.border", null,
 800             "Spinner.arrowButtonSize", new Dimension(16, 5),
 801             "Spinner.ancestorInputMap", aquaKeyBindings.getSpinnerInputMap(),
 802             "Spinner.editorBorderPainted", Boolean.TRUE,
 803             "Spinner.editorAlignment", SwingConstants.TRAILING,
 804 
 805             // *** SplitPane
 806             //"SplitPane.highlight", table.get("controlLtHighlight"),
 807             //"SplitPane.shadow", table.get("controlShadow"),
 808             "SplitPane.background", panelBackgroundColor,
 809             "SplitPane.border", scollListBorder,
 810             "SplitPane.dividerSize", new Integer(9), //$
 811             "SplitPaneDivider.border", null, // AquaSplitPaneDividerUI draws it
 812             "SplitPaneDivider.horizontalGradientVariant", new SwingLazyValue(PKG_PREFIX + "AquaSplitPaneDividerUI", "getHorizontalSplitDividerGradientVariant"),
 813 
 814             // *** TabbedPane
 815             "TabbedPane.font", controlFont,
 816             "TabbedPane.smallFont", controlSmallFont,
 817             "TabbedPane.useSmallLayout", Boolean.FALSE,//sSmallTabs ? Boolean.TRUE : Boolean.FALSE,
 818             "TabbedPane.background", tabBackgroundColor, // for bug [3398277] use a background color so that
 819             // tabs on a custom pane get erased when they are removed.
 820             "TabbedPane.foreground", black, //ThemeTextColor.GetThemeTextColor(AppearanceConstants.kThemeTextColorTabFrontActive),
 821             //"TabbedPane.lightHighlight", table.get("controlLtHighlight"),
 822             //"TabbedPane.highlight", table.get("controlHighlight"),
 823             //"TabbedPane.shadow", table.get("controlShadow"),
 824             //"TabbedPane.darkShadow", table.get("controlDkShadow"),
 825             //"TabbedPane.focus", table.get("controlText"),
 826             "TabbedPane.opaque", useOpaqueComponents,
 827             "TabbedPane.textIconGap", new Integer(4),
 828             "TabbedPane.tabInsets", new InsetsUIResource(0, 10, 3, 10), // Label within tab (top, left, bottom, right)
 829             //"TabbedPane.rightTabInsets", new InsetsUIResource(0, 10, 3, 10), // Label within tab (top, left, bottom, right)
 830             "TabbedPane.leftTabInsets", new InsetsUIResource(0, 10, 3, 10), // Label within tab
 831             "TabbedPane.rightTabInsets", new InsetsUIResource(0, 10, 3, 10), // Label within tab
 832             //"TabbedPane.tabAreaInsets", new InsetsUIResource(3, 9, -1, 9), // Tabs relative to edge of pane (negative value for overlapping)
 833             "TabbedPane.tabAreaInsets", new InsetsUIResource(3, 9, -1, 9), // Tabs relative to edge of pane (negative value for overlapping)
 834             // (top = side opposite pane, left = edge || to pane, bottom = side adjacent to pane, right = left) - see rotateInsets
 835             "TabbedPane.contentBorderInsets", new InsetsUIResource(8, 0, 0, 0), // width of border
 836             //"TabbedPane.selectedTabPadInsets", new InsetsUIResource(0, 0, 1, 0), // Really outsets, this is where we allow for overlap
 837             "TabbedPane.selectedTabPadInsets", new InsetsUIResource(0, 0, 0, 0), // Really outsets, this is where we allow for overlap
 838             "TabbedPane.tabsOverlapBorder", Boolean.TRUE,
 839             "TabbedPane.selectedTabTitlePressedColor", selectedTabTitlePressedColor,
 840             "TabbedPane.selectedTabTitleDisabledColor", selectedTabTitleDisabledColor,
 841             "TabbedPane.selectedTabTitleNormalColor", selectedTabTitleNormalColor,
 842             "TabbedPane.selectedTabTitleShadowDisabledColor", selectedTabTitleShadowDisabledColor,
 843             "TabbedPane.selectedTabTitleShadowNormalColor", selectedTabTitleShadowNormalColor,
 844             "TabbedPane.nonSelectedTabTitleNormalColor", nonSelectedTabTitleNormalColor,
 845 
 846             // *** Table
 847             "Table.font", viewFont, // [3577901] Aqua HIG says "default font of text in lists and tables" should be 12 point (vm).
 848             "Table.foreground", black, // cell text color
 849             "Table.background", white, // cell background color
 850             "Table.selectionForeground", selectionForeground,
 851             "Table.selectionBackground", selectionBackground,
 852             "Table.selectionInactiveBackground", selectionInactiveBackground,
 853             "Table.selectionInactiveForeground", selectionInactiveForeground,
 854             "Table.gridColor", white, // grid line color
 855             "Table.focusCellBackground", textHighlightText,
 856             "Table.focusCellForeground", textHighlight,
 857             "Table.focusCellHighlightBorder", focusCellHighlightBorder,
 858             "Table.scrollPaneBorder", scollListBorder,
 859 
 860             "Table.ancestorInputMap", aquaKeyBindings.getTableInputMap(),
 861             "Table.ancestorInputMap.RightToLeft", aquaKeyBindings.getTableRightToLeftInputMap(),
 862 
 863             "TableHeader.font", controlSmallFont,
 864             "TableHeader.foreground", black,
 865             "TableHeader.background", white, // header background
 866             "TableHeader.cellBorder", listHeaderBorder,
 867 
 868             // *** Text
 869             "TextArea.focusInputMap", aquaKeyBindings.getMultiLineTextInputMap(),
 870             "TextArea.font", controlFont,
 871             "TextArea.background", textBackground,
 872             "TextArea.foreground", textForeground,
 873             "TextArea.inactiveForeground", textInactiveText,
 874             "TextArea.inactiveBackground", textInactiveBackground,
 875             "TextArea.selectionBackground", textHighlight,
 876             "TextArea.selectionForeground", textHighlightText,
 877             "TextArea.caretForeground", textForeground,
 878             "TextArea.caretBlinkRate", textCaretBlinkRate,
 879             "TextArea.border", textAreaBorder,
 880             "TextArea.margin", zeroInsets,
 881 
 882             "TextComponent.selectionBackgroundInactive", textHighlightInactive,
 883 
 884             "TextField.focusInputMap", aquaKeyBindings.getTextFieldInputMap(),
 885             "TextField.font", controlFont,
 886             "TextField.background", textBackground,
 887             "TextField.foreground", textForeground,
 888             "TextField.inactiveForeground", textInactiveText,
 889             "TextField.inactiveBackground", textInactiveBackground,
 890             "TextField.selectionBackground", textHighlight,
 891             "TextField.selectionForeground", textHighlightText,
 892             "TextField.caretForeground", textForeground,
 893             "TextField.caretBlinkRate", textCaretBlinkRate,
 894             "TextField.border", textFieldBorder,
 895             "TextField.margin", zeroInsets,
 896 
 897             "TextPane.focusInputMap", aquaKeyBindings.getMultiLineTextInputMap(),
 898             "TextPane.font", controlFont,
 899             "TextPane.background", textBackground,
 900             "TextPane.foreground", textForeground,
 901             "TextPane.selectionBackground", textHighlight,
 902             "TextPane.selectionForeground", textHighlightText,
 903             "TextPane.caretForeground", textForeground,
 904             "TextPane.caretBlinkRate", textCaretBlinkRate,
 905             "TextPane.inactiveForeground", textInactiveText,
 906             "TextPane.inactiveBackground", textInactiveBackground,
 907             "TextPane.border", textAreaBorder,
 908             "TextPane.margin", editorMargin,
 909 
 910             // *** ToggleButton
 911             "ToggleButton.background", controlBackgroundColor,
 912             "ToggleButton.foreground", black,
 913             "ToggleButton.disabledText", disabled,
 914             // we need to go through and find out if these are used, and if not what to set
 915             // so that subclasses will get good aqua like colors.
 916             //    "ToggleButton.select", getControlShadow(),
 917             //    "ToggleButton.text", getControl(),
 918             //    "ToggleButton.disabledSelectedText", getControlDarkShadow(),
 919             //    "ToggleButton.disabledBackground", getControl(),
 920             //    "ToggleButton.disabledSelectedBackground", getControlShadow(),
 921             //"ToggleButton.focus", getFocusColor(),
 922             "ToggleButton.border", new SwingLazyValue(PKG_PREFIX + "AquaButtonBorder", "getDynamicButtonBorder"), // sja make this lazy!
 923             "ToggleButton.font", controlFont,
 924             "ToggleButton.focusInputMap", controlFocusInputMap,
 925             "ToggleButton.margin", new InsetsUIResource(2, 2, 2, 2),
 926 
 927             // *** ToolBar
 928             "ToolBar.font", controlFont,
 929             "ToolBar.background", panelBackgroundColor,
 930             "ToolBar.foreground", new ColorUIResource(Color.gray),
 931             "ToolBar.dockingBackground", panelBackgroundColor,
 932             "ToolBar.dockingForeground", selectionBackground,
 933             "ToolBar.floatingBackground", panelBackgroundColor,
 934             "ToolBar.floatingForeground", new ColorUIResource(Color.darkGray),
 935             "ToolBar.border", new SwingLazyValue(PKG_PREFIX + "AquaToolBarUI", "getToolBarBorder"),
 936             "ToolBar.borderHandleColor", toolbarDragHandleColor,
 937             //"ToolBar.separatorSize", new DimensionUIResource( 10, 10 ),
 938             "ToolBar.separatorSize", null,
 939 
 940             // *** ToolBarButton
 941             "ToolBarButton.margin", new InsetsUIResource(3, 3, 3, 3),
 942             "ToolBarButton.insets", new InsetsUIResource(1, 1, 1, 1),
 943 
 944             // *** ToolTips
 945             "ToolTip.font", controlSmallFont,
 946             //$ Tooltips - Same color as help balloons?
 947             "ToolTip.background", toolTipBackground,
 948             "ToolTip.foreground", black,
 949             "ToolTip.border", toolTipBorder,
 950 
 951             // *** Tree
 952             "Tree.font", viewFont, // [3577901] Aqua HIG says "default font of text in lists and tables" should be 12 point (vm).
 953             "Tree.background", white,
 954             "Tree.foreground", black,
 955             // for now no lines
 956             "Tree.hash", white, //disabled, // Line color
 957             "Tree.line", white, //disabled, // Line color
 958             "Tree.textForeground", black,
 959             "Tree.textBackground", white,
 960             "Tree.selectionForeground", selectionForeground,
 961             "Tree.selectionBackground", selectionBackground,
 962             "Tree.selectionInactiveBackground", selectionInactiveBackground,
 963             "Tree.selectionInactiveForeground", selectionInactiveForeground,
 964             "Tree.selectionBorderColor", selectionBackground, // match the background so it looks like we don't draw anything
 965             "Tree.editorBorderSelectionColor", null, // The EditTextFrame provides its own border
 966             // "Tree.editorBorder", textFieldBorder, // If you still have Sun bug 4376328 in DefaultTreeCellEditor, it has to have the same insets as TextField.border
 967             "Tree.leftChildIndent", new Integer(7),//$
 968             "Tree.rightChildIndent", new Integer(13),//$
 969             "Tree.rowHeight", new Integer(19),// iconHeight + 3, to match finder - a zero would have the renderer decide, except that leaves the icons touching
 970             "Tree.scrollsOnExpand", Boolean.FALSE,
 971             "Tree.openIcon", new SwingLazyValue(kAquaImageFactoryName, "getTreeOpenFolderIcon"), // Open folder icon
 972             "Tree.closedIcon", new SwingLazyValue(kAquaImageFactoryName, "getTreeFolderIcon"), // Closed folder icon
 973             "Tree.leafIcon", new SwingLazyValue(kAquaImageFactoryName, "getTreeDocumentIcon"), // Document icon
 974             "Tree.expandedIcon", new SwingLazyValue(kAquaImageFactoryName, "getTreeExpandedIcon"),
 975             "Tree.collapsedIcon", new SwingLazyValue(kAquaImageFactoryName, "getTreeCollapsedIcon"),
 976             "Tree.rightToLeftCollapsedIcon", new SwingLazyValue(kAquaImageFactoryName, "getTreeRightToLeftCollapsedIcon"),
 977             "Tree.changeSelectionWithFocus", Boolean.TRUE,
 978             "Tree.drawsFocusBorderAroundIcon", Boolean.FALSE,
 979 
 980             "Tree.focusInputMap", aquaKeyBindings.getTreeInputMap(),
 981             "Tree.focusInputMap.RightToLeft", aquaKeyBindings.getTreeRightToLeftInputMap(),
 982             "Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[]{"ESCAPE", "cancel"}),};
 983 
 984         table.putDefaults(defaults);
 985 
 986         Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
 987         table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
 988     }
 989 
 990     protected void initSystemColorDefaults(final UIDefaults table) {
 991 //        String[] defaultSystemColors = {
 992 //                  "desktop", "#005C5C", /* Color of the desktop background */
 993 //          "activeCaption", "#000080", /* Color for captions (title bars) when they are active. */
 994 //          "activeCaptionText", "#FFFFFF", /* Text color for text in captions (title bars). */
 995 //        "activeCaptionBorder", "#C0C0C0", /* Border color for caption (title bar) window borders. */
 996 //            "inactiveCaption", "#808080", /* Color for captions (title bars) when not active. */
 997 //        "inactiveCaptionText", "#C0C0C0", /* Text color for text in inactive captions (title bars). */
 998 //      "inactiveCaptionBorder", "#C0C0C0", /* Border color for inactive caption (title bar) window borders. */
 999 //                 "window", "#FFFFFF", /* Default color for the interior of windows */
1000 //           "windowBorder", "#000000", /* ??? */
1001 //             "windowText", "#000000", /* ??? */
1002 //               "menu", "#C0C0C0", /* Background color for menus */
1003 //               "menuText", "#000000", /* Text color for menus  */
1004 //               "text", "#C0C0C0", /* Text background color */
1005 //               "textText", "#000000", /* Text foreground color */
1006 //          "textHighlight", "#000080", /* Text background color when selected */
1007 //          "textHighlightText", "#FFFFFF", /* Text color when selected */
1008 //           "textInactiveText", "#808080", /* Text color when disabled */
1009 //                "control", "#C0C0C0", /* Default color for controls (buttons, sliders, etc) */
1010 //            "controlText", "#000000", /* Default color for text in controls */
1011 //           "controlHighlight", "#C0C0C0", /* Specular highlight (opposite of the shadow) */
1012 //         "controlLtHighlight", "#FFFFFF", /* Highlight color for controls */
1013 //          "controlShadow", "#808080", /* Shadow color for controls */
1014 //            "controlDkShadow", "#000000", /* Dark shadow color for controls */
1015 //              "scrollbar", "#E0E0E0", /* Scrollbar background (usually the "track") */
1016 //               "info", "#FFFFE1", /* ??? */
1017 //               "infoText", "#000000"  /* ??? */
1018 //        };
1019 //
1020 //        loadSystemColors(table, defaultSystemColors, isNativeLookAndFeel());
1021     }
1022 
1023     /**
1024      * Initialize the uiClassID to AquaComponentUI mapping.
1025      * The JComponent classes define their own uiClassID constants
1026      * (see AbstractComponent.getUIClassID).  This table must
1027      * map those constants to a BasicComponentUI class of the
1028      * appropriate type.
1029      *
1030      * @see #getDefaults
1031      */
1032     protected void initClassDefaults(final UIDefaults table) {
1033         final String basicPackageName = "javax.swing.plaf.basic.";
1034 
1035         final Object[] uiDefaults = {
1036             "ButtonUI", PKG_PREFIX + "AquaButtonUI",
1037             "CheckBoxUI", PKG_PREFIX + "AquaButtonCheckBoxUI",
1038             "CheckBoxMenuItemUI", PKG_PREFIX + "AquaMenuItemUI",
1039             "LabelUI", PKG_PREFIX + "AquaLabelUI",
1040             "ListUI", PKG_PREFIX + "AquaListUI",
1041             "MenuUI", PKG_PREFIX + "AquaMenuUI",
1042             "MenuItemUI", PKG_PREFIX + "AquaMenuItemUI",
1043             "OptionPaneUI", PKG_PREFIX + "AquaOptionPaneUI",
1044             "PanelUI", PKG_PREFIX + "AquaPanelUI",
1045             "RadioButtonMenuItemUI", PKG_PREFIX + "AquaMenuItemUI",
1046             "RadioButtonUI", PKG_PREFIX + "AquaButtonRadioUI",
1047             "ProgressBarUI", PKG_PREFIX + "AquaProgressBarUI",
1048             "RootPaneUI", PKG_PREFIX + "AquaRootPaneUI",
1049             "SliderUI", PKG_PREFIX + "AquaSliderUI",
1050             "ScrollBarUI", PKG_PREFIX + "AquaScrollBarUI",
1051             "TabbedPaneUI", PKG_PREFIX + (JRSUIUtils.TabbedPane.shouldUseTabbedPaneContrastUI() ? "AquaTabbedPaneContrastUI" : "AquaTabbedPaneUI"),
1052             "TableUI", PKG_PREFIX + "AquaTableUI",
1053             "ToggleButtonUI", PKG_PREFIX + "AquaButtonToggleUI",
1054             "ToolBarUI", PKG_PREFIX + "AquaToolBarUI",
1055             "ToolTipUI", PKG_PREFIX + "AquaToolTipUI",
1056             "TreeUI", PKG_PREFIX + "AquaTreeUI",
1057 
1058             "InternalFrameUI", PKG_PREFIX + "AquaInternalFrameUI",
1059             "DesktopIconUI", PKG_PREFIX + "AquaInternalFrameDockIconUI",
1060             "DesktopPaneUI", PKG_PREFIX + "AquaInternalFramePaneUI",
1061             "EditorPaneUI", PKG_PREFIX + "AquaEditorPaneUI",
1062             "TextFieldUI", PKG_PREFIX + "AquaTextFieldUI",
1063             "TextPaneUI", PKG_PREFIX + "AquaTextPaneUI",
1064             "ComboBoxUI", PKG_PREFIX + "AquaComboBoxUI",
1065             "PopupMenuUI", PKG_PREFIX + "AquaPopupMenuUI",
1066             "TextAreaUI", PKG_PREFIX + "AquaTextAreaUI",
1067             "MenuBarUI", PKG_PREFIX + "AquaMenuBarUI",
1068             "FileChooserUI", PKG_PREFIX + "AquaFileChooserUI",
1069             "PasswordFieldUI", PKG_PREFIX + "AquaTextPasswordFieldUI",
1070             "TableHeaderUI", PKG_PREFIX + "AquaTableHeaderUI",
1071 
1072             "FormattedTextFieldUI", PKG_PREFIX + "AquaTextFieldFormattedUI",
1073 
1074             "SpinnerUI", PKG_PREFIX + "AquaSpinnerUI",
1075             "SplitPaneUI", PKG_PREFIX + "AquaSplitPaneUI",
1076             "ScrollPaneUI", PKG_PREFIX + "AquaScrollPaneUI",
1077 
1078             "PopupMenuSeparatorUI", PKG_PREFIX + "AquaPopupMenuSeparatorUI",
1079             "SeparatorUI", PKG_PREFIX + "AquaPopupMenuSeparatorUI",
1080             "ToolBarSeparatorUI", PKG_PREFIX + "AquaToolBarSeparatorUI",
1081 
1082             // as we implement aqua versions of the swing elements
1083             // we will aad the com.apple.laf.FooUI classes to this table.
1084 
1085             "ColorChooserUI", basicPackageName + "BasicColorChooserUI",
1086 
1087             // text UIs
1088             "ViewportUI", basicPackageName + "BasicViewportUI",
1089         };
1090         table.putDefaults(uiDefaults);
1091     }
1092 }