1
package org.pushingpixels.substance.internal.utils;
4
import java.util.Locale;
6
import javax.swing.Icon;
7
import javax.swing.UIDefaults;
8
import javax.swing.UIManager;
9
import javax.swing.border.EmptyBorder;
10
import javax.swing.plaf.*;
11
import javax.swing.plaf.basic.BasicBorders;
12
import javax.swing.plaf.basic.BasicBorders.MarginBorder;
14
import org.pushingpixels.substance.api.*;
15
import org.pushingpixels.substance.api.inputmaps.InputMapSet;
16
import org.pushingpixels.substance.api.inputmaps.SubstanceInputMapUtilities;
17
import org.pushingpixels.substance.api.renderers.SubstanceDefaultListCellRenderer;
18
import org.pushingpixels.substance.internal.utils.border.*;
19
import org.pushingpixels.substance.internal.utils.icon.*;
20
import org.pushingpixels.substance.internal.utils.scroll.SubstanceScrollPaneBorder;
22
public class SkinUtilities {
24
* Adds skin-specific entries to the UI defaults table.
29
public static void addCustomEntriesToTable(UIDefaults table,
31
Object menuArrowIcon = new UIDefaults.LazyValue() {
33
public Object createValue(UIDefaults table) {
34
return new MenuArrowIcon(null);
38
Object listCellRendererActiveValue = new UIDefaults.ActiveValue() {
40
public Object createValue(UIDefaults table) {
41
return new SubstanceDefaultListCellRenderer.SubstanceUIResource();
45
SubstanceColorScheme mainActiveScheme = skin
46
.getActiveColorScheme(DecorationAreaType.NONE);
47
SubstanceColorScheme mainEnabledScheme = skin
48
.getEnabledColorScheme(DecorationAreaType.NONE);
49
SubstanceColorScheme mainDisabledScheme = skin
50
.getDisabledColorScheme(DecorationAreaType.NONE);
51
Color control = new ColorUIResource(
52
mainActiveScheme.getLightColor());
53
Color foregroundColor = SubstanceColorUtilities
54
.getForegroundColor(mainEnabledScheme);
55
Color backgroundActiveColor = new ColorUIResource(
56
mainActiveScheme.getBackgroundFillColor());
57
Color backgroundDefaultColor = new ColorUIResource(
58
mainEnabledScheme.getBackgroundFillColor());
59
Color textBackgroundColor = new ColorUIResource(
60
mainActiveScheme.getTextBackgroundFillColor());
62
Color disabledForegroundColor = SubstanceColorUtilities
63
.getForegroundColor(mainDisabledScheme);
64
Color disabledTextComponentForegroundColor = disabledForegroundColor;
65
float alpha = skin.getAlpha(null, ComponentState.DISABLED_UNSELECTED);
67
ColorUIResource defaultTextBackgroundColor = SubstanceColorUtilities
68
.getDefaultBackgroundColor(true, skin, false);
69
disabledTextComponentForegroundColor = new ColorUIResource(
70
SubstanceColorUtilities.getInterpolatedColor(
71
disabledTextComponentForegroundColor,
72
defaultTextBackgroundColor, alpha));
75
Color lineColor = new ColorUIResource(mainActiveScheme.getLineColor());
77
Color lineColorDefault = new ColorUIResource(
78
mainEnabledScheme.getLineColor());
80
int lcb = SubstanceColorUtilities
81
.getColorBrightness(lineColor.getRGB());
82
Color lineBwColor = new ColorUIResource(new Color(lcb, lcb, lcb));
84
SubstanceColorScheme textHighlightColorScheme = skin.getColorScheme(
85
(Component) null, ColorSchemeAssociationKind.TEXT_HIGHLIGHT,
86
ComponentState.SELECTED);
87
if (textHighlightColorScheme == null) {
88
textHighlightColorScheme = skin.getColorScheme(null,
89
ComponentState.ROLLOVER_SELECTED);
91
Color selectionTextBackgroundColor = new ColorUIResource(
92
textHighlightColorScheme.getSelectionBackgroundColor());
93
Color selectionTextForegroundColor = new ColorUIResource(
94
textHighlightColorScheme.getSelectionForegroundColor());
96
Color selectionCellForegroundColor = new ColorUIResource(
97
textHighlightColorScheme.getForegroundColor());
98
Color selectionCellBackgroundColor = new ColorUIResource(
99
textHighlightColorScheme.getBackgroundFillColor());
101
Object regularMarginBorder = new UIDefaults.LazyValue() {
103
public Object createValue(UIDefaults table) {
104
return new BorderUIResource.CompoundBorderUIResource(
105
new SubstanceBorder(), new BasicBorders.MarginBorder());
109
Object textBorder = new UIDefaults.LazyValue() {
111
public Object createValue(UIDefaults table) {
112
return new BorderUIResource.CompoundBorderUIResource(
113
new SubstanceTextComponentBorder(
115
.getTextBorderInsets(SubstanceSizeUtils
116
.getControlFontSize())),
117
new BasicBorders.MarginBorder());
121
Object textMarginBorder = new UIDefaults.LazyValue() {
123
public Object createValue(UIDefaults table) {
124
return new BasicBorders.MarginBorder();
128
Object tooltipBorder = new UIDefaults.LazyValue() {
130
public Object createValue(UIDefaults table) {
131
return new SubstanceBorder(
133
.getToolTipBorderInsets(SubstanceSizeUtils
134
.getControlFontSize()));
138
Object comboBorder = new UIDefaults.LazyValue() {
140
public Object createValue(UIDefaults table) {
141
return new SubstanceBorder(
143
.getComboBorderInsets(SubstanceSizeUtils
144
.getControlFontSize()));
148
Object spinnerBorder = new UIDefaults.LazyValue() {
150
public Object createValue(UIDefaults table) {
151
return new BorderUIResource.CompoundBorderUIResource(
152
new SubstanceTextComponentBorder(
154
.getSpinnerBorderInsets(SubstanceSizeUtils
155
.getControlFontSize())),
156
new BasicBorders.MarginBorder());
160
// SubstanceColorSchemeBundle titlePaneBundle =
161
// skin.colorSchemeBundleMap
162
// .containsKey(DecorationAreaType.PRIMARY_TITLE_PANE) ?
163
// skin.colorSchemeBundleMap
164
// .get(DecorationAreaType.PRIMARY_TITLE_PANE)
165
// : skin.colorSchemeBundleMap.get(DecorationAreaType.NONE);
166
final SubstanceColorScheme titlePaneScheme = skin
167
.getBackgroundColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE);
168
// /skin.getColorScheme(
169
// DecorationAreaType.PRIMARY_TITLE_PANE,
170
// ColorSchemeAssociationKind.FILL, ComponentState.ACTIVE);
172
// titlePaneBundle.getActiveColorScheme();
174
Object menuItemInsets = new UIDefaults.LazyValue() {
176
public Object createValue(UIDefaults table) {
177
int menuItemMargin = SubstanceSizeUtils
178
.getMenuItemMargin(SubstanceSizeUtils
179
.getComponentFontSize(null));
180
return new InsetsUIResource(menuItemMargin, menuItemMargin,
181
menuItemMargin, menuItemMargin);
185
Object emptyIcon = new UIDefaults.LazyValue() {
187
public Object createValue(UIDefaults table) {
188
return new IconUIResource(new Icon() {
190
public int getIconHeight() {
191
// return the value that matches the core height, so
192
// that the DefaultTreeCellEditor.EditorContainer
193
// returns the correct value in its getPreferredSize
194
// when it consults the "editingIcon" height.
199
public int getIconWidth() {
204
public void paintIcon(Component c, Graphics g, int x, int y) {
210
Object[] defaults = new Object[] {
212
new ColorUIResource(skin.getBackgroundColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE).getBackgroundFillColor()),
214
"activeCaptionBorder",
215
new ColorUIResource(skin.getColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED).getBackgroundFillColor()),
218
SubstanceColorUtilities.getForegroundColor(skin.getBackgroundColorScheme(
219
DecorationAreaType.PRIMARY_TITLE_PANE)),
222
new ColorUIResource(mainEnabledScheme.getBackgroundFillColor()),
225
new ColorUIResource(mainEnabledScheme.getUltraDarkColor()),
228
new ColorUIResource(mainEnabledScheme.getLightColor()),
230
"controlLtHighlight",
231
new ColorUIResource(mainEnabledScheme.getExtraLightColor()),
234
new ColorUIResource(mainEnabledScheme.getDarkColor()),
237
new ColorUIResource(mainEnabledScheme.getForegroundColor()),
240
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
244
new ColorUIResource(skin.getBackgroundColorScheme(
245
UIManager.getBoolean(SubstanceLookAndFeel.WINDOW_AUTO_DEACTIVATE)
246
? DecorationAreaType.PRIMARY_TITLE_PANE
247
: DecorationAreaType.PRIMARY_TITLE_PANE_INACTIVE
248
).getBackgroundFillColor()),
250
"inactiveCaptionBorder",
251
new ColorUIResource(skin.getColorScheme(
252
UIManager.getBoolean(SubstanceLookAndFeel.WINDOW_AUTO_DEACTIVATE)
253
? DecorationAreaType.PRIMARY_TITLE_PANE
254
: DecorationAreaType.PRIMARY_TITLE_PANE_INACTIVE,
255
ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED).getBackgroundFillColor()),
257
"inactiveCaptionText",
258
SubstanceColorUtilities.getForegroundColor(skin.getBackgroundColorScheme(
259
UIManager.getBoolean(SubstanceLookAndFeel.WINDOW_AUTO_DEACTIVATE)
260
? DecorationAreaType.PRIMARY_TITLE_PANE
261
: DecorationAreaType.PRIMARY_TITLE_PANE_INACTIVE)),
264
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
271
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
278
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
282
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
286
selectionTextBackgroundColor,
289
selectionTextForegroundColor,
292
disabledTextComponentForegroundColor,
298
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
308
"Button.defaultButtonFollowsFocus",
311
"Button.disabledText",
312
disabledForegroundColor,
318
new InsetsUIResource(0, 0, 0, 0),
320
"CheckBox.background",
321
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
325
new BorderUIResource.CompoundBorderUIResource(
326
SubstanceSizeUtils.getCheckBoxBorder(
327
SubstanceSizeUtils.getControlFontSize(),
328
ComponentOrientation.getOrientation(
329
Locale.getDefault()).isLeftToRight()),
332
"CheckBox.disabledText",
333
disabledForegroundColor,
335
"CheckBox.foreground",
338
"CheckBoxMenuItem.acceleratorForeground",
341
"CheckBoxMenuItem.acceleratorSelectionForeground",
344
"CheckBoxMenuItem.background",
345
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
348
"CheckBoxMenuItem.borderPainted",
351
"CheckBoxMenuItem.checkIcon",
352
new CheckBoxMenuItemIcon(null,
353
1 + SubstanceSizeUtils
354
.getMenuCheckMarkSize(SubstanceSizeUtils
355
.getControlFontSize())),
357
"CheckBoxMenuItem.disabledForeground",
358
disabledForegroundColor,
360
"CheckBoxMenuItem.foreground",
363
"CheckBoxMenuItem.margin",
366
"CheckBoxMenuItem.selectionForeground",
367
selectionCellForegroundColor,
369
"ColorChooser.background",
370
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
373
"ColorChooser.foreground",
376
"ComboBox.background",
377
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
383
"ComboBox.disabledBackground",
386
"ComboBox.disabledForeground",
387
disabledForegroundColor,
389
"ComboBox.foreground",
392
"ComboBox.selectionBackground",
393
selectionCellBackgroundColor,
395
"ComboBox.selectionForeground",
396
selectionCellForegroundColor,
398
"DesktopIcon.border",
404
"Desktop.background",
405
new ColorUIResource(new Color(0x0, true)),
407
"Desktop.foreground",
411
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
414
"EditorPane.background",
415
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
421
"EditorPane.foreground",
424
"EditorPane.caretForeground",
427
"EditorPane.disabledBackground",
428
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
431
"EditorPane.inactiveBackground",
432
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
435
"EditorPane.inactiveForeground",
436
disabledTextComponentForegroundColor,
438
"EditorPane.selectionBackground",
439
selectionTextBackgroundColor,
441
"EditorPane.selectionForeground",
442
selectionTextForegroundColor,
444
"FileChooser.upFolderIcon",
445
new UIDefaults.LazyValue() {
447
public Object createValue(UIDefaults table) {
448
return SubstanceCoreUtilities
449
.getIcon("resource/go-up.png");
453
"FileChooser.newFolderIcon",
454
new UIDefaults.LazyValue() {
456
public Object createValue(UIDefaults table) {
457
return SubstanceCoreUtilities
458
.getIcon("resource/folder-new.png");
462
"FileChooser.homeFolderIcon",
463
new UIDefaults.LazyValue() {
465
public Object createValue(UIDefaults table) {
466
return SubstanceCoreUtilities
467
.getIcon("resource/user-home.png");
471
"FileChooser.listViewIcon",
472
new UIDefaults.LazyValue() {
474
public Object createValue(UIDefaults table) {
475
return SubstanceCoreUtilities
476
.getIcon("resource/application_view_list.png");
480
"FileChooser.detailsViewIcon",
481
new UIDefaults.LazyValue() {
483
public Object createValue(UIDefaults table) {
484
return SubstanceCoreUtilities
485
.getIcon("resource/application_view_detail.png");
489
"FileChooser.usesSingleFilePane",
492
"FileView.computerIcon",
493
new UIDefaults.LazyValue() {
495
public Object createValue(UIDefaults table) {
496
return SubstanceCoreUtilities
497
.getIcon("resource/computer.png");
501
"FileView.directoryIcon",
502
new UIDefaults.LazyValue() {
504
public Object createValue(UIDefaults table) {
505
return SubstanceCoreUtilities
506
.getIcon("resource/folder.png");
511
new UIDefaults.LazyValue() {
513
public Object createValue(UIDefaults table) {
514
return SubstanceCoreUtilities
515
.getIcon("resource/text-x-generic.png");
519
"FileView.floppyDriveIcon",
520
new UIDefaults.LazyValue() {
522
public Object createValue(UIDefaults table) {
523
return SubstanceCoreUtilities
524
.getIcon("resource/media-floppy.png");
528
"FileView.hardDriveIcon",
529
new UIDefaults.LazyValue() {
531
public Object createValue(UIDefaults table) {
532
return SubstanceCoreUtilities
533
.getIcon("resource/drive-harddisk.png");
537
"FormattedTextField.background",
538
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
541
"FormattedTextField.border",
544
"FormattedTextField.caretForeground",
547
"FormattedTextField.disabledBackground",
548
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
551
"FormattedTextField.foreground",
554
"FormattedTextField.inactiveBackground",
555
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
558
"FormattedTextField.inactiveForeground",
559
disabledTextComponentForegroundColor,
561
"FormattedTextField.selectionBackground",
562
selectionTextBackgroundColor,
564
"FormattedTextField.selectionForeground",
565
selectionTextForegroundColor,
567
"InternalFrame.activeTitleBackground",
568
new ColorUIResource(skin.getBackgroundColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE).getBackgroundFillColor()),
570
"InternalFrame.activeTitleForeground",
571
SubstanceColorUtilities.getForegroundColor(skin.getBackgroundColorScheme(
572
DecorationAreaType.PRIMARY_TITLE_PANE)),
574
"InternalFrame.inactiveTitleBackground",
575
new ColorUIResource(skin.getBackgroundColorScheme(DecorationAreaType.PRIMARY_TITLE_PANE_INACTIVE).getBackgroundFillColor()),
577
"InternalFrame.inactiveTitleForeground",
578
SubstanceColorUtilities.getForegroundColor(skin.getBackgroundColorScheme(
579
DecorationAreaType.PRIMARY_TITLE_PANE_INACTIVE)),
581
"InternalFrame.border",
582
new BorderUIResource(new SubstancePaneBorder()),
584
"InternalFrame.closeIcon",
585
new UIDefaults.LazyValue() {
587
public Object createValue(UIDefaults table) {
588
return SubstanceImageCreator.getCloseIcon(
589
titlePaneScheme, titlePaneScheme);
593
"InternalFrame.iconifyIcon",
594
new UIDefaults.LazyValue() {
596
public Object createValue(UIDefaults table) {
597
return SubstanceImageCreator.getMinimizeIcon(
598
titlePaneScheme, titlePaneScheme);
602
"InternalFrame.maximizeIcon",
603
new UIDefaults.LazyValue() {
605
public Object createValue(UIDefaults table) {
606
return SubstanceImageCreator.getMaximizeIcon(
607
titlePaneScheme, titlePaneScheme);
611
"InternalFrame.minimizeIcon",
612
new UIDefaults.LazyValue() {
614
public Object createValue(UIDefaults table) {
615
return SubstanceImageCreator.getRestoreIcon(
616
titlePaneScheme, titlePaneScheme);
620
"InternalFrame.paletteCloseIcon",
621
new UIDefaults.LazyValue() {
623
public Object createValue(UIDefaults table) {
624
return SubstanceImageCreator.getCloseIcon(
625
titlePaneScheme, titlePaneScheme);
630
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
636
"Label.disabledText",
637
disabledForegroundColor,
639
"Label.disabledForeground",
640
disabledForegroundColor,
643
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
647
listCellRendererActiveValue,
649
"List.focusCellHighlightBorder",
650
new SubstanceBorder(new Insets(1, 1, 1, 1)),
652
"List.focusSelectedCellHighlightBorder",
653
new BorderUIResource.EmptyBorderUIResource(1, 1, 1, 1),
658
"List.selectionBackground",
659
selectionCellBackgroundColor,
661
"List.selectionForeground",
662
selectionCellForegroundColor,
668
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
671
"Menu.borderPainted",
677
"Menu.disabledForeground",
678
disabledForegroundColor,
686
"Menu.selectionForeground",
687
selectionCellForegroundColor,
689
"MenuBar.background",
690
skin.isRegisteredAsDecorationArea(DecorationAreaType.HEADER) ? new ColorUIResource(
691
skin.getActiveColorScheme(DecorationAreaType.HEADER)
692
.getMidColor()) : SubstanceColorUtilities
693
.getDefaultBackgroundColor(false, skin, false),
695
"MenuBar.foreground",
696
new ColorUIResource(skin.getActiveColorScheme(
697
DecorationAreaType.HEADER).getForegroundColor()),
702
"MenuItem.acceleratorForeground",
705
"MenuItem.acceleratorSelectionForeground",
708
"MenuItem.background",
709
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
712
"MenuItem.borderPainted",
715
"MenuItem.checkIcon",
718
"MenuItem.disabledForeground",
719
disabledForegroundColor,
721
"MenuItem.foreground",
727
"MenuItem.selectionForeground",
728
selectionCellForegroundColor,
730
"OptionPane.background",
731
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
734
"OptionPane.errorIcon",
735
new UIDefaults.LazyValue() {
737
public Object createValue(UIDefaults table) {
738
return SubstanceCoreUtilities
739
.getIcon("resource/32/dialog-error.png");
743
"OptionPane.foreground",
746
"OptionPane.informationIcon",
747
new UIDefaults.LazyValue() {
749
public Object createValue(UIDefaults table) {
750
return SubstanceCoreUtilities
751
.getIcon("resource/32/dialog-information.png");
755
"OptionPane.messageForeground",
758
"OptionPane.questionIcon",
759
new UIDefaults.LazyValue() {
761
public Object createValue(UIDefaults table) {
762
return SubstanceCoreUtilities
763
.getIcon("resource/32/help-browser.png");
767
"OptionPane.warningIcon",
768
new UIDefaults.LazyValue() {
770
public Object createValue(UIDefaults table) {
771
return SubstanceCoreUtilities
772
.getIcon("resource/32/dialog-warning.png");
777
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
783
"PasswordField.background",
784
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
787
"PasswordField.border",
790
"PasswordField.caretForeground",
793
"PasswordField.disabledBackground",
794
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
797
"PasswordField.foreground",
800
"PasswordField.inactiveBackground",
801
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
804
"PasswordField.inactiveForeground",
805
disabledTextComponentForegroundColor,
807
"PasswordField.selectionBackground",
808
selectionTextBackgroundColor,
810
"PasswordField.selectionForeground",
811
selectionTextForegroundColor,
813
"PopupMenu.background",
814
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
820
"ProgressBar.border",
821
new BorderUIResource(new SubstanceBorder()),
823
"ProgressBar.cycleTime",
826
"ProgressBar.repaintInterval",
829
"ProgressBar.horizontalSize",
830
new DimensionUIResource(146,
831
SubstanceSizeUtils.getControlFontSize()),
833
"ProgressBar.verticalSize",
834
new DimensionUIResource(
835
SubstanceSizeUtils.getControlFontSize(), 146),
837
"ProgressBar.selectionBackground",
840
"ProgressBar.selectionForeground",
843
"RadioButton.background",
844
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
847
"RadioButton.border",
848
new BorderUIResource.CompoundBorderUIResource(
849
SubstanceSizeUtils.getRadioButtonBorder(
850
SubstanceSizeUtils.getControlFontSize(),
851
ComponentOrientation.getOrientation(
852
Locale.getDefault()).isLeftToRight()),
855
"RadioButton.foreground",
858
"RadioButton.disabledText",
859
disabledForegroundColor,
861
"RadioButtonMenuItem.acceleratorForeground",
864
"RadioButtonMenuItem.acceleratorSelectionForeground",
867
"RadioButtonMenuItem.background",
868
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
871
"RadioButtonMenuItem.borderPainted",
874
"RadioButtonMenuItem.checkIcon",
875
new RadioButtonMenuItemIcon(null,
877
.getMenuCheckMarkSize(SubstanceSizeUtils
878
.getControlFontSize())),
880
"RadioButtonMenuItem.disabledForeground",
881
disabledForegroundColor,
883
"RadioButtonMenuItem.foreground",
886
"RadioButtonMenuItem.margin",
889
"RadioButtonMenuItem.selectionForeground",
890
selectionCellForegroundColor,
892
"RootPane.background",
893
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
897
new SubstancePaneBorder(),
899
"ScrollBar.background",
900
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
904
SubstanceSizeUtils.getScrollBarWidth(SubstanceSizeUtils
905
.getControlFontSize()),
907
"ScrollBar.minimumThumbSize",
908
new DimensionUIResource(
909
SubstanceSizeUtils.getScrollBarWidth(SubstanceSizeUtils
910
.getControlFontSize()) - 2,
911
SubstanceSizeUtils.getScrollBarWidth(SubstanceSizeUtils
912
.getControlFontSize()) - 2),
914
"ScrollPane.background",
915
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
918
"ScrollPane.foreground",
922
new SubstanceScrollPaneBorder(),
924
"Separator.background",
925
backgroundDefaultColor,
927
"Separator.foreground",
930
"Slider.altTrackColor",
934
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
943
"Slider.focusInsets",
944
new InsetsUIResource(2, 2, 0, 2),
958
"Spinner.arrowButtonInsets",
960
.getSpinnerArrowButtonInsets(SubstanceSizeUtils
961
.getControlFontSize()),
963
"Spinner.background",
964
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
970
"Spinner.disableOnBoundaryValues",
973
"Spinner.foreground",
976
"Spinner.editorBorderPainted",
979
"SplitPane.background",
980
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
983
"SplitPane.foreground",
986
"SplitPane.dividerFocusColor",
987
backgroundDefaultColor,
989
"SplitPaneDivider.draggingColor",
990
backgroundActiveColor,
993
new BorderUIResource(new EmptyBorder(0, 0, 0, 0)),
995
"SplitPane.dividerSize",
996
(int) (SubstanceSizeUtils.getArrowIconWidth(SubstanceSizeUtils
997
.getControlFontSize()) + SubstanceSizeUtils
999
SubstanceSizeUtils.getControlFontSize(), -1, 6,
1002
"SplitPaneDivider.border",
1003
new BorderUIResource(new EmptyBorder(1, 1, 1, 1)),
1005
"TabbedPane.tabAreaBackground",
1006
backgroundDefaultColor,
1008
"TabbedPane.unselectedBackground",
1009
backgroundDefaultColor,
1011
"TabbedPane.background",
1012
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
1015
"TabbedPane.borderHightlightColor",
1016
new ColorUIResource(mainActiveScheme.getMidColor()),
1018
"TabbedPane.contentAreaColor",
1021
"TabbedPane.contentBorderInsets",
1022
new InsetsUIResource(4, 4, 4, 4),
1024
"TabbedPane.contentOpaque",
1027
"TabbedPane.darkShadow",
1028
new ColorUIResource(skin.getColorScheme((Component) null,
1029
ColorSchemeAssociationKind.BORDER,
1030
ComponentState.SELECTED).getLineColor()),
1035
"TabbedPane.foreground",
1038
"TabbedPane.highlight",
1039
new ColorUIResource(mainActiveScheme.getLightColor()),
1042
mainEnabledScheme.isDark() ? new ColorUIResource(
1043
SubstanceColorUtilities.getAlphaColor(
1044
mainEnabledScheme.getUltraDarkColor(), 100))
1045
: new ColorUIResource(mainEnabledScheme.getLightColor()),
1047
"TabbedPane.selected",
1048
new ColorUIResource(mainActiveScheme.getExtraLightColor()),
1050
"TabbedPane.selectedForeground",
1053
"TabbedPane.selectHighlight",
1054
new ColorUIResource(mainActiveScheme.getMidColor()),
1056
"TabbedPane.shadow",
1057
new ColorUIResource(
1058
SubstanceColorUtilities.getInterpolatedColor(
1059
mainEnabledScheme.getExtraLightColor(),
1060
mainEnabledScheme.getLightColor(), 0.5)),
1062
"TabbedPane.tabRunOverlay",
1066
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
1069
"Table.cellNoFocusBorder",
1070
new BorderUIResource.EmptyBorderUIResource(
1072
.getDefaultBorderInsets(SubstanceSizeUtils
1073
.getComponentFontSize(null))),
1075
"Table.focusCellBackground",
1076
backgroundActiveColor,
1078
"Table.focusCellForeground",
1081
"Table.focusCellHighlightBorder",
1082
new SubstanceBorder(),
1090
"Table.scrollPaneBorder",
1091
new SubstanceScrollPaneBorder(),
1093
"Table.selectionBackground",
1094
selectionCellBackgroundColor,
1096
"Table.selectionForeground",
1097
selectionCellForegroundColor,
1099
"TableHeader.cellBorder",
1102
"TableHeader.foreground",
1105
"TableHeader.background",
1106
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
1109
"TextArea.background",
1110
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
1116
"TextArea.caretForeground",
1119
"TextArea.disabledBackground",
1120
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
1123
"TextArea.foreground",
1126
"TextArea.inactiveBackground",
1127
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
1130
"TextArea.inactiveForeground",
1131
disabledTextComponentForegroundColor,
1133
"TextArea.selectionBackground",
1134
selectionTextBackgroundColor,
1136
"TextArea.selectionForeground",
1137
selectionTextForegroundColor,
1139
"TextField.background",
1140
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
1146
"TextField.caretForeground",
1149
"TextField.disabledBackground",
1150
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
1153
"TextField.foreground",
1156
"TextField.inactiveBackground",
1157
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
1160
"TextField.inactiveForeground",
1161
disabledTextComponentForegroundColor,
1163
"TextField.selectionBackground",
1164
selectionTextBackgroundColor,
1166
"TextField.selectionForeground",
1167
selectionTextForegroundColor,
1169
"TextPane.background",
1170
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
1176
"TextPane.disabledBackground",
1177
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
1180
"TextPane.foreground",
1183
"TextPane.caretForeground",
1186
"TextPane.inactiveBackground",
1187
SubstanceColorUtilities.getDefaultBackgroundColor(true, skin,
1190
"TextPane.inactiveForeground",
1191
disabledTextComponentForegroundColor,
1193
"TextPane.selectionBackground",
1194
selectionTextBackgroundColor,
1196
"TextPane.selectionForeground",
1197
selectionTextForegroundColor,
1199
"TitledBorder.titleColor",
1202
"TitledBorder.border",
1203
new SubstanceEtchedBorder(),
1205
"ToggleButton.foreground",
1208
"ToggleButton.disabledText",
1209
disabledForegroundColor,
1211
"ToggleButton.margin",
1212
new InsetsUIResource(0, 0, 0, 0),
1214
"ToolBar.background",
1215
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
1219
new BorderUIResource(new SubstanceToolBarBorder()),
1221
"ToolBar.isRollover",
1224
"ToolBar.foreground",
1227
"ToolBarSeparator.background",
1228
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
1231
"ToolBarSeparator.foreground",
1234
"ToolBar.separatorSize",
1240
"ToolTip.borderInactive",
1243
"ToolTip.background",
1244
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
1247
"ToolTip.backgroundInactive",
1248
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
1251
"ToolTip.foreground",
1254
"ToolTip.foregroundInactive",
1255
disabledForegroundColor,
1260
"Tree.collapsedIcon",
1261
new UIDefaults.LazyValue() {
1263
public Object createValue(UIDefaults table) {
1264
return new IconUIResource(
1265
SubstanceIconFactory.getTreeIcon(null, true));
1269
"Tree.expandedIcon",
1270
new UIDefaults.LazyValue() {
1272
public Object createValue(UIDefaults table) {
1273
return new IconUIResource(
1274
SubstanceIconFactory.getTreeIcon(null, false));
1285
SubstanceColorUtilities.getDefaultBackgroundColor(false, skin,
1288
"Tree.selectionBackground", selectionCellBackgroundColor,
1290
"Tree.foreground", foregroundColor,
1292
"Tree.hash", lineColorDefault,
1294
"Tree.rowHeight", 0,
1296
"Tree.selectionBorderColor", lineColor,
1298
"Tree.selectionForeground", selectionCellForegroundColor,
1300
"Tree.textBackground", backgroundDefaultColor,
1302
"Tree.textForeground", foregroundColor,
1304
"Viewport.background", backgroundDefaultColor,
1306
"Viewport.foreground", foregroundColor,
1308
SubstanceLookAndFeel.WINDOW_AUTO_DEACTIVATE,
1309
skin.isRegisteredAsDecorationArea(DecorationAreaType.PRIMARY_TITLE_PANE_INACTIVE),
1312
table.putDefaults(defaults);
1315
InputMapSet inputMapSet = SubstanceInputMapUtilities
1316
.getSystemInputMapSet();
1317
if (inputMapSet == null) {
1318
throw new IllegalStateException("Input map set is null!");
1321
table.put("Button.focusInputMap", inputMapSet.getButtonFocusInputMap()
1323
table.put("CheckBox.focusInputMap", inputMapSet
1324
.getCheckBoxFocusInputMap().getUiMap());
1325
table.put("ComboBox.ancestorInputMap", inputMapSet
1326
.getComboBoxAncestorInputMap().getUiMap());
1327
table.put("Desktop.ancestorInputMap", inputMapSet
1328
.getDesktopAncestorInputMap().getUiMap());
1329
table.put("EditorPane.focusInputMap", inputMapSet
1330
.getEditorPaneFocusInputMap().getUiMap());
1331
table.put("FileChooser.ancestorInputMap", inputMapSet
1332
.getFileChooserAncestorInputMap().getUiMap());
1333
table.put("FormattedTextField.focusInputMap", inputMapSet
1334
.getFormattedTextFieldFocusInputMap().getUiMap());
1335
table.put("List.focusInputMap", inputMapSet.getListFocusInputMap()
1337
table.put("PasswordField.focusInputMap", inputMapSet
1338
.getPasswordFieldFocusInputMap().getUiMap());
1339
table.put("RadioButton.focusInputMap", inputMapSet
1340
.getRadioButtonFocusInputMap().getUiMap());
1341
table.put("RootPane.ancestorInputMap", inputMapSet
1342
.getRootPaneAncestorInputMap().getUiMap());
1343
table.put("ScrollBar.ancestorInputMap", inputMapSet
1344
.getScrollBarAncestorInputMap().getUiMap());
1345
table.put("ScrollPane.ancestorInputMap", inputMapSet
1346
.getScrollPaneAncestorInputMap().getUiMap());
1347
table.put("Slider.focusInputMap", inputMapSet.getSliderFocusInputMap()
1349
table.put("Spinner.ancestorInputMap", inputMapSet
1350
.getSpinnerAncestorInputMap().getUiMap());
1351
table.put("SplitPane.ancestorInputMap", inputMapSet
1352
.getSplitPaneAncestorInputMap().getUiMap());
1353
table.put("TabbedPane.ancestorInputMap", inputMapSet
1354
.getTabbedPaneAncestorInputMap().getUiMap());
1355
table.put("TabbedPane.focusInputMap", inputMapSet
1356
.getTabbedPaneFocusInputMap().getUiMap());
1357
table.put("Table.ancestorInputMap", inputMapSet
1358
.getTableAncestorInputMap().getUiMap());
1359
table.put("TableHeader.ancestorInputMap", inputMapSet
1360
.getTableHeaderAncestorInputMap().getUiMap());
1361
table.put("TextArea.focusInputMap", inputMapSet
1362
.getTextAreaFocusInputMap().getUiMap());
1363
table.put("TextField.focusInputMap", inputMapSet
1364
.getTextFieldFocusInputMap().getUiMap());
1365
table.put("TextPane.focusInputMap", inputMapSet
1366
.getTextPaneFocusInputMap().getUiMap());
1367
table.put("ToggleButton.focusInputMap", inputMapSet
1368
.getToggleButtonFocusInputMap().getUiMap());
1369
table.put("ToolBar.ancestorInputMap", inputMapSet
1370
.getToolBarAncestorInputMap().getUiMap());
1371
table.put("Tree.ancestorInputMap", inputMapSet
1372
.getTreeAncestorInputMap().getUiMap());
1373
table.put("Tree.focusInputMap", inputMapSet.getTreeFocusInputMap()