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