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