1
- /*
1
+ /**
2
2
* MIT License
3
3
*
4
- * Copyright (c) 2018-2019 atharva washimkar,
5
- * Copyright (c) 2019 Vincent Palazzo vincenzopalazzodev@gmail.com
4
+ * Copyright (c) 2018-2020 atharva washimkar, Vincenzo Palazzo vincenzopalazzo1996@gmail.com
6
5
*
7
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
8
7
* of this software and associated documentation files (the "Software"), to deal
74
73
75
74
import javax .swing .*;
76
75
import javax .swing .plaf .BorderUIResource ;
76
+ import javax .swing .plaf .InsetsUIResource ;
77
77
import javax .swing .plaf .basic .BasicLookAndFeel ;
78
78
import javax .swing .plaf .metal .MetalLookAndFeel ;
79
79
import javax .swing .text .DefaultEditorKit ;
@@ -254,6 +254,8 @@ protected void initComponentDefaults(UIDefaults table) {
254
254
table .put ("Button.foreground" , theme .getButtonTextColor ());
255
255
table .put ("Button[Default].background" , theme .getButtonDefaultBackgroundColor ());
256
256
table .put ("Button[Default].foreground" , theme .getButtonDefaultTextColor ());
257
+ // table.put("Button[Default].disabledBackground", MaterialColors.LIGHT_BLUE_800);
258
+ //table.put("Button[Default].disabledForeground", MaterialColors.COSMO_DARK_GRAY);
257
259
table .put ("Button.disabledBackground" , theme .getButtonDisabledBackground ());
258
260
table .put ("Button.disabledForeground" , theme .getButtonDisabledForeground ());
259
261
table .put ("Button.font" , theme .getButtonFont ());
@@ -265,7 +267,7 @@ protected void initComponentDefaults(UIDefaults table) {
265
267
table .put ("Button[focus].color" , theme .getButtonFocusColor ());
266
268
table .put ("Button.disabledText" , theme .getButtonDisableTextColor ());
267
269
table .put ("Button[Default].shadowPixel" , 3 );
268
- table .put ("Button[Default].shadowEnable" , false );
270
+ // table.put("Button[Default].shadowEnable", false); removed
269
271
table .put ("Button[Default][focus].color" , theme .getButtonDefaultFocusColor ());
270
272
table .put ("Button[border].enable" , theme .getButtonBorderEnable ());
271
273
table .put ("Button[border].color" , theme .getButtonBorderColor ());
@@ -302,7 +304,9 @@ protected void initComponentDefaults(UIDefaults table) {
302
304
table .put ("Label.font" , theme .getFontRegular ());
303
305
table .put ("Label.background" , theme .getBackgroundPrimary ());
304
306
table .put ("Label.foreground" , theme .getTextColor ());
305
- table .put ("Label.opaque" , true );
307
+ //TODO remove set opaque to material-ui-swing because this propriety is an ""BUG""
308
+ //and this is an good answer implementation on stack overflow https://stackoverflow.com/a/2452381/10854225
309
+ // table.put("Label.opaque", true);
306
310
table .put ("Label.disabledForeground" , theme .getDisableTextColor ());
307
311
table .put ("Label.border" , new BorderUIResource (BorderFactory .createEmptyBorder ()));
308
312
@@ -387,37 +391,45 @@ protected void initComponentDefaults(UIDefaults table) {
387
391
table .put ("Slider[halo].color" , theme .getHaloColorSlider ());
388
392
table .put ("Slider.border" , theme .getBorderSlider ());
389
393
394
+ // also, look this style https://material.io/design/platform-guidance/android-split-screen.html#usage
390
395
table .put ("SplitPane.border" , theme .getBorderPanel ());
391
- table .put ("SplitPane.background" , theme .getBackgroundPrimary ());
392
- table .put ("SplitPane.dividerSize" , 5 );
393
- table .put ("SplitPaneDivider.border" , new BorderUIResource (BorderFactory .createEmptyBorder ()));
394
- table .put ("SplitPaneDivider.background" , theme .getBackgroundPrimary ());
395
-
396
+ table .put ("SplitPane.background" , theme .getDisableTextColor ());
397
+ table .put ("SplitPane.dividerSize" , theme .getSizeDividierSplitPane ());
398
+ table .put ("SplitPaneDivider.border" , theme .getDividierBorderSplitPane ());
399
+ table .put ("SplitPaneDivider.background" , theme .getColorDividierSplitPane ());
400
+ table .put ("SplitPaneDivider.draggingColor" , theme .getColorDividierFocusSplitPane ());
401
+
402
+ //TODO the comment proprieties will be remove to version 1.2 of the library
403
+ //for the moment are deprecated
396
404
table .put ("TabbedPane.font" , theme .getFontRegular ());
397
405
table .put ("TabbedPane.background" , theme .getBackgroundPrimary ());
398
406
table .put ("TabbedPane.tabAreaBackground" , theme .getBackgroundPrimary ());
399
407
table .put ("TabbedPane.foreground" , theme .getTextColor ());
408
+ table .put ("TabbedPane.disabledForeground" , theme .getDisableTextColor ());
400
409
table .put ("TabbedPane.selectionForeground" , theme .getFocusColorLineTabbedPane ());
401
410
table .put ("TabbedPane.contentAreaColor" , theme .getButtonTextColor ());
402
411
table .put ("TabbedPane.disableContentAreaColor" , theme .getDisableColorTabTabbedPane ());
403
412
table .put ("TabbedPane.border" , theme .getBorderPanel ());
404
413
table .put ("TabbedPane.shadow" , theme .getBackgroundPrimary ());
405
- table .put ("TabbedPane.darkShadow" , theme .getBackgroundPrimary ());
414
+ table .put ("TabbedPane.darkShadow" , theme .getBackgroundPrimary ()); //TODO add another propriety for change this color in the MaterialTheming
406
415
table .put ("TabbedPane.highlight" , theme .getDisableTextColor ());
407
416
table .put ("TabbedPane.selected" , theme .getTextColor ());
408
417
table .put ("TabbedPane.light" , theme .getBackgroundPrimary ());
409
418
table .put ("TabbedPane.borderHighlightColor" , theme .getBorderHighlightColorTabbedPane ());
410
419
table .put ("TabbedPane[focus].colorLine" , theme .getFocusColorLineTabbedPane ());
411
420
table .put ("TabbedPane[MouseHover].enable" , theme .getMouseHoverEnableTabbedPane ());
412
- table .put ("TabbedPane.spacer" , theme .getSpacerTabbedPane ());
413
- table .put ("TabbedPane.indent" , theme .getIndentTabbedPane ());
414
- table .put ("TabbedPane.tabInsets" , theme .getTabInsetsTabbedPane ());
421
+ //table.put("TabbedPane.spacer", theme.getSpacerTabbedPane());
422
+ //table.put("TabbedPane.indent", theme.getIndentTabbedPane());
423
+ table .put ("TabbedPane.tabInsets" , new InsetsUIResource (6 , 12 , 10 , 12 ));
424
+ table .put ("TabbedPane.contentBorderInsets" , new InsetsUIResource (6 , 20 , 10 , 20 ));
415
425
table .put ("TabbedPane.selectedTabPadInsets" , theme .getSelectedTabInsetsTabbedPane ());
416
- table .put ("TabbedPane.linePositionY" , theme .getLinePositionYTabbedPane ());
417
- table .put ("TabbedPane.linePositionX" , theme .getLinePositionXTabbedPane ());
418
- table .put ("TabbedPane.lineWidth" , theme .getLineWithTabbedPane ());
426
+ // table.put("TabbedPane.linePositionY", theme.getLinePositionYTabbedPane());
427
+ // table.put("TabbedPane.linePositionX", theme.getLinePositionXTabbedPane());
428
+ // table.put("TabbedPane.lineWidth", theme.getLineWithTabbedPane());
419
429
table .put ("TabbedPane.lineHeight" , theme .getLineHeightTabbedPane ());
420
- table .put ("TabbedPane.lineArch" , theme .getLineArchTabbedPane ());
430
+ //table.put("TabbedPane.lineArch", theme.getLineArchTabbedPane());
431
+ table .put ("TabbedPane[focus].margin" , 5 );
432
+
421
433
422
434
table .put ("Table.selectionBackground" , theme .getSelectionBackgroundTable ());
423
435
table .put ("Table.selectionForeground" , theme .getSelectionForegroundTable ());
@@ -428,20 +440,28 @@ protected void initComponentDefaults(UIDefaults table) {
428
440
table .put ("Table.gridColor" , theme .getGridColorTable ());
429
441
table .put ("Table.focusable" , theme .getTableFocusable ());
430
442
table .put ("Table.opaque" , theme .getTableOpaque ());
431
- table .put ("Table.alternateRowColor" , theme .getAlternateRowColorEnableTable ());
432
- table .put ("Table.alternateRowBackground" , theme .getAlternateRowBackgroundTable ());
443
+ //This propriety was used also how default
444
+ //TODO refactoring this proprieties
445
+ //TODO add why
446
+ table .put ("Table.alternateRowColor" , theme .getAlternateRowBackgroundTable ());
447
+ //table.put("Table.alternateRowColor", theme.getAlternateRowColorEnableTable());
448
+ //table.put("Table.alternateRowBackground", theme.getAlternateRowBackgroundTable());
433
449
table .put ("Table[row].height" , theme .getHeightRowTable ());
434
450
table .put ("Table[CheckBox].checked" , theme .getSelectedCheckBoxIconTable ());
435
451
table .put ("Table[CheckBox].unchecked" , theme .getUnselectedCheckBoxIconTable ());
436
452
table .put ("Table[CheckBox].selectionChecked" , theme .getSelectedCheckBoxIconSelectionRowTable ());
437
453
table .put ("Table[CheckBox].selectionUnchecked" , theme .getUnselectedCheckBoxIconSelectionRowTable ());
438
454
table .put ("Table.focusCellHighlightBorder" , new BorderUIResource (BorderFactory .createEmptyBorder ()));
455
+ table .put ("Table.showVerticalLines" , false );
456
+ table .put ("Table.showHorizontalLines" , false );
457
+ table .put ("Table.intercellSpacing" , new java .awt .Dimension (0 , 0 ));
439
458
440
459
table .put ("TableHeader.background" , theme .getBackgroundTableHeader ());
441
460
table .put ("TableHeader.foreground" , theme .getForegroundTableHeader ());
442
461
table .put ("TableHeader.border" , theme .getBorderTableHeader ());
443
462
table .put ("TableHeader.font" , theme .getFontBold ());
444
463
table .put ("TableHeader.cellBorder" , theme .getCellBorderTableHeader ());
464
+ table .put ("TableHeader.gridColor" , theme .getBackgroundTableHeader ());
445
465
446
466
table .put ("TextArea.background" , theme .getBackgroundTextField ());
447
467
table .put ("TextArea.border" , theme .getBorderTextField ());
@@ -456,8 +476,15 @@ protected void initComponentDefaults(UIDefaults table) {
456
476
table .put ("ToggleButton.select" , theme .getHighlightBackgroundPrimary ());
457
477
table .put ("ToggleButton.foreground" , theme .getTextColor ());
458
478
table .put ("ToggleButton.disabledText" , theme .getDisableTextColor ());
459
- table .put ("ToggleButton.icon" , MaterialImageFactory .getInstance ().getImage (MaterialImageFactory .TOGGLE_BUTTON_BLACK_OFF ));
460
- table .put ("ToggleButton.selectedIcon" , MaterialImageFactory .getInstance ().getImage (MaterialImageFactory .TOGGLE_BUTTON_BLACK_ON ));
479
+ table .put ("ToggleButton.icon" , theme .getUnselectedIconToggleButton ());
480
+ table .put ("ToggleButton.selectedIcon" , theme .getSelectedIconToggleButton ());
481
+ table .put ("ToggleButton.withoutIcon" , theme .isWithoutIconToggleButton ());
482
+ table .put ("ToggleButton[withoutIcon].selectedBackground" , theme .getWithoutIconSelectedBackgroundToggleButton ());
483
+ table .put ("ToggleButton[withoutIcon].selectedForeground" , theme .getWithoutIconSelectedForegoundToggleButton ());
484
+ table .put ("ToggleButton[withoutIcon].background" , theme .getWithoutIconBackgroundToggleButton ());
485
+ table .put ("ToggleButton[withoutIcon].foreground" , theme .getWithoutIconForegroundToggleButton ());
486
+ table .put ("ToggleButton[withoutIcon].selectedBorder" , theme .getWithoutIconSelectedBorderToggleButton ());
487
+ table .put ("ToggleButton[withoutIcon].border" , theme .getWithoutIconBorderToggleButton ());
461
488
462
489
table .put ("ToolBar.font" , theme .getFontRegular ());
463
490
table .put ("ToolBar.background" , theme .getBackgroundPrimary ());
@@ -472,6 +499,7 @@ protected void initComponentDefaults(UIDefaults table) {
472
499
table .put ("Tree.selectionBackground" , theme .getSelectionBackgroundTree ());
473
500
table .put ("Tree.background" , theme .getBackgroundPrimary ());
474
501
table .put ("Tree.selectionBorderColor" , theme .getSelectionBorderColorTree ());
502
+ table .put ("Tree.border" , theme .getBorderTree ());
475
503
table .put ("Tree.collapsedIcon" , null );
476
504
table .put ("Tree.expandedIcon" , null );
477
505
table .put ("Tree.closedIcon" , theme .getClosedIconTree ());
@@ -510,8 +538,8 @@ protected void initComponentDefaults(UIDefaults table) {
510
538
table .put ("EditorPane.font" , theme .getFontRegular ());
511
539
table .put ("EditorPane.focusInputMap" , multilineInputMap );
512
540
513
- table .put ("Separator.background" , MaterialColors . GRAY_300 );
514
- table .put ("Separator.foreground" , MaterialColors . GRAY_300 );
541
+ table .put ("Separator.background" , theme . getBackgroundSeparator () );
542
+ table .put ("Separator.foreground" , theme . getForegroundSeparator () );
515
543
516
544
table .put ("ToolTip.background" , MaterialColors .GRAY_500 );
517
545
table .put ("ToolTip.foreground" , MaterialColors .GRAY_50 );
@@ -520,6 +548,8 @@ protected void initComponentDefaults(UIDefaults table) {
520
548
table .put ("TextField.background" , theme .getBackgroundTextField ());
521
549
table .put ("TextField.foreground" , theme .getTextColor ());
522
550
table .put ("TextField.font" , theme .getFontRegular ());
551
+ table .put ("TextField.disabledBackground" , theme .getDisabledBackgroudnTextField ());
552
+ table .put ("TextField.disabledForeground" , theme .getDisabledForegroundTextField ());
523
553
table .put ("TextField.inactiveForeground" , theme .getInactiveForegroundTextField ());
524
554
table .put ("TextField.inactiveBackground" , theme .getInactiveBackgroundTextField ());
525
555
table .put ("TextField.selectionBackground" , theme .getSelectionBackgroundTextField ());
@@ -531,6 +561,8 @@ protected void initComponentDefaults(UIDefaults table) {
531
561
532
562
table .put ("PasswordField.background" , theme .getBackgroundTextField ());
533
563
table .put ("PasswordField.foreground" , theme .getTextColor ());
564
+ table .put ("PasswordField.disabledBackground" , theme .getDisabledBackgroudnTextField ());
565
+ table .put ("PasswordField.disabledForeground" , theme .getDisabledForegroundTextField ());
534
566
table .put ("PasswordField.inactiveForeground" , theme .getInactiveForegroundTextField ());
535
567
table .put ("PasswordField.inactiveBackground" , theme .getInactiveBackgroundTextField ());
536
568
table .put ("PasswordField.selectionBackground" , theme .getSelectionBackgroundTextField ());
@@ -541,10 +573,11 @@ protected void initComponentDefaults(UIDefaults table) {
541
573
table .put ("PasswordField.echoChar" , theme .getEchoCharPasswordField ());
542
574
table .put ("PasswordField.focusInputMap" , fieldInputMap );
543
575
544
- table .put ("TitledBorder.border" , MaterialBorders . LIGHT_LINE_BORDER );
576
+ table .put ("TitledBorder.border" , theme . getBorderTitledBorder () );
545
577
table .put ("TitledBorder.font" , theme .getFontMedium ());
578
+ table .put ("TitledBorder.titleColor" , theme .getColorTextTitledBorder ());
546
579
547
- table .put ("TaskPane .font" , theme .getFontMedium ());
580
+ table .put ("TaskTaskPane .font" , theme .getFontMedium ());
548
581
table .put ("TaskPane.titleBackgroundGradientStart" , theme .getTitleBackgroundGradientStartTaskPane ());
549
582
table .put ("TaskPane.titleBackgroundGradientEnd" , theme .getTitleBackgroundGradientEndTaskPane ());
550
583
table .put ("TaskPane.titleOver" , theme .getTitleOverTaskPane ());
@@ -589,7 +622,7 @@ protected void initComponentDefaults(UIDefaults table) {
589
622
//TODO exist an bug inside the icon
590
623
table .put ("InternalFrame.maximizeIcon" , MaterialImageFactory .getInstance ().getImage (MaterialImageFactory .MAXIMIZE_WINDOWS_WHITE ));
591
624
table .put ("InternalFrame.minimizeIcon" , MaterialImageFactory .getInstance ().getImage (MaterialImageFactory .MINIMIZE_WINDOWS_WHITE ));
592
- table .put ("InternalFrame.closeIcon" , MaterialImageFactory . getInstance (). getImage ( MaterialImageFactory . CLOSE_WINDOWS_WHITE ));
625
+ table .put ("InternalFrame.closeIcon" , theme . getIconCloseTitlePane ( ));
593
626
table .put ("InternalFrame.iconifyIcon" , MaterialImageFactory .getInstance ().getImage (MaterialImageFactory .ICONIFY_WINDOWS_WHITE ));
594
627
table .put ("InternalFrame.activeTitleBackground" , MaterialColors .COSMO_BLACK );
595
628
table .put ("InternalFrame.activeTitleForeground" , MaterialColors .BLACK );
0 commit comments