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