22
33import mdlaf .button .MaterialButtonUI ;
44import mdlaf .password .MaterialPasswordFieldUI ;
5+ import mdlaf .table .MaterialTableHeaderUI ;
6+ import mdlaf .table .MaterialTableUI ;
57import mdlaf .textfield .MaterialTextFieldUI ;
68
79import javax .swing .BorderFactory ;
810import javax .swing .UIDefaults ;
9- import javax .swing .border .Border ;
1011import javax .swing .plaf .basic .BasicLookAndFeel ;
1112import java .awt .Color ;
1213
@@ -15,6 +16,8 @@ public class MaterialLookAndFeel extends BasicLookAndFeel {
1516 private static final String buttonUI = MaterialButtonUI .class .getCanonicalName ();
1617 private static final String textfieldUI = MaterialTextFieldUI .class .getCanonicalName ();
1718 private static final String passwordFieldUI = MaterialPasswordFieldUI .class .getCanonicalName ();
19+ private static final String tableUI = MaterialTableUI .class .getCanonicalName ();
20+ private static final String tableHeaderUI = MaterialTableHeaderUI .class .getCanonicalName ();
1821
1922 @ Override
2023
@@ -48,6 +51,8 @@ protected void initClassDefaults (UIDefaults table) {
4851 table .put ("ButtonUI" , buttonUI );
4952 table .put ("TextFieldUI" , textfieldUI );
5053 table .put ("PasswordFieldUI" , passwordFieldUI );
54+ table .put ("TableUI" , tableUI );
55+ table .put ("TableHeaderUI" , tableHeaderUI );
5156 }
5257
5358 @ Override
@@ -63,7 +68,6 @@ protected void initComponentDefaults (UIDefaults table) {
6368 System .setProperty ("swing.aatext" , "true" );
6469 System .setProperty ("sun.java2d.xrender" , "true" );
6570
66- table .put ("Button.font" , MaterialFonts .MEDIUM );
6771 table .put ("RadioButton.font" , MaterialFonts .REGULAR );
6872 table .put ("CheckBox.font" , MaterialFonts .REGULAR );
6973 table .put ("ComboBox.font" , MaterialFonts .REGULAR );
@@ -74,14 +78,8 @@ protected void initComponentDefaults (UIDefaults table) {
7478 table .put ("OptionPane.font" , MaterialFonts .REGULAR );
7579 table .put ("Panel.font" , MaterialFonts .REGULAR );
7680 table .put ("ScrollPane.font" , MaterialFonts .REGULAR );
77- table .put ("Table.font" , MaterialFonts .REGULAR );
78- table .put ("TableHeader.font" , MaterialFonts .REGULAR );
79- table .put ("TextField.font" , MaterialFonts .REGULAR );
8081 table .put ("TextArea.font" , MaterialFonts .REGULAR );
8182
82- Border menuBorder = new DropShadowBorder (Color .BLACK , 0 , 5 , 0.3f , 12 , true , true , true , true );
83- Border defaultBorder = new DropShadowBorder (Color .BLACK , 5 , 5 , 0.3f , 12 , true , true , true , true );
84-
8583 table .put ("Panel.background" , Color .WHITE );
8684 table .put ("Panel.border" , BorderFactory .createEmptyBorder ());
8785
@@ -94,6 +92,7 @@ protected void initComponentDefaults (UIDefaults table) {
9492
9593 table .put ("PopupMenu.border" , BorderFactory .createLineBorder (MaterialColors .LIGHT_GRAY , 1 ));
9694 table .put ("PopupMenu.background" , Color .WHITE );
95+
9796 table .put ("Menu.border" , BorderFactory .createEmptyBorder (5 , 5 , 5 , 5 ));
9897 table .put ("Menu.selectionBackground" , MaterialColors .LIGHT_GRAY );
9998 table .put ("Menu.selectionForeground" , Color .BLACK );
@@ -104,7 +103,7 @@ protected void initComponentDefaults (UIDefaults table) {
104103 table .put ("Menu.menuPopupOffsetY" , 10 );
105104
106105 table .put ("MenuBar.background" , Color .WHITE );
107- table .put ("MenuBar.border" , menuBorder );
106+ table .put ("MenuBar.border" , MaterialBorders . LIGHT_SHADOW_BORDER );
108107
109108 table .put ("SplitPane.border" , BorderFactory .createEmptyBorder ());
110109 table .put ("SplitPane.background" , Color .WHITE );
@@ -114,20 +113,13 @@ protected void initComponentDefaults (UIDefaults table) {
114113 table .put ("ScrollPane.background" , Color .WHITE );
115114 table .put ("ScrollPane.border" , BorderFactory .createEmptyBorder ());
116115
117- table .put ("TextField.background" , MaterialColors .LIGHT_BLUE );
118-
119- table .put ("PasswordField.background" , MaterialColors .LIGHT_BLUE );
120-
121116 table .put ("TextArea.background" , MaterialColors .LIGHT_GRAY );
122117 table .put ("TextArea.border" , BorderFactory .createEmptyBorder ());
123118 table .put ("TextArea.foreground" , Color .BLACK );
124119
125120 table .put ("OptionPane.background" , Color .WHITE );
126- table .put ("OptionPane.border" , defaultBorder );
121+ table .put ("OptionPane.border" , MaterialBorders . DEFAULT_SHADOW_BORDER );
127122
128- table .put ("Button.background" , MaterialColors .LIGHT_BLUE );
129- table .put ("Button.foreground" , Color .WHITE );
130123 table .put ("Button.highlight" , MaterialColors .LIGHT_GRAY );
131- //table.put ("Button.border", BorderFactory.createEmptyBorder (10, 10, 10, 10));
132124 }
133125}
0 commit comments