2
2
3
3
import mdlaf .components .button .MaterialButtonUI ;
4
4
import mdlaf .components .checkbox .MaterialCheckBoxUI ;
5
+ import mdlaf .components .combobox .MaterialComboBoxRender ;
5
6
import mdlaf .components .combobox .MaterialComboBoxUI ;
6
7
import mdlaf .components .label .MaterialLabelUI ;
7
8
import mdlaf .components .menu .MaterialMenuUI ;
8
9
import mdlaf .components .menubar .MaterialMenuBarUI ;
9
10
import mdlaf .components .menuitem .MaterialMenuItemUI ;
10
11
import mdlaf .components .panel .MaterialPanelUI ;
11
12
import mdlaf .components .password .MaterialPasswordFieldUI ;
12
- import mdlaf .components .popupmenu .MaterialPopupMenuUI ;
13
13
import mdlaf .components .progressbar .MaterialProgressBarUI ;
14
14
import mdlaf .components .radiobutton .MaterialRadioButtonUI ;
15
15
import mdlaf .components .scrollbar .MaterialScrollBarUI ;
27
27
import mdlaf .resources .MaterialFonts ;
28
28
import mdlaf .resources .MaterialImages ;
29
29
30
- import javax .swing .*;
31
- import javax .swing .plaf .metal .MetalLookAndFeel ;
32
- import java .awt .*;
30
+ import javax .swing .BorderFactory ;
31
+ import javax .swing .ImageIcon ;
32
+ import javax .swing .UIDefaults ;
33
+ import javax .swing .plaf .basic .BasicLookAndFeel ;
34
+ import java .awt .Color ;
33
35
34
- public class MaterialLookAndFeel extends MetalLookAndFeel {
36
+ public class MaterialLookAndFeel extends BasicLookAndFeel {
35
37
36
38
private static final String buttonUI = MaterialButtonUI .class .getCanonicalName ();
37
39
private static final String textfieldUI = MaterialTextFieldUI .class .getCanonicalName ();
@@ -50,11 +52,12 @@ public class MaterialLookAndFeel extends MetalLookAndFeel {
50
52
private static final String tabbedPaneUI = MaterialTabbedPaneUI .class .getCanonicalName ();
51
53
private static final String toggleButtonUI = MaterialToggleButtonUI .class .getCanonicalName ();
52
54
private static final String scrollBarUI = MaterialScrollBarUI .class .getCanonicalName ();
53
- private static final String comboBoxUI = MaterialComboBoxUI .class .getCanonicalName ();
54
- private static final String popupMenuUI = MaterialPopupMenuUI .class .getCanonicalName ();
55
- private static final String toolbarUI = MaterialToolBarUI .class .getCanonicalName ();
56
- private static final String sliderUI = MaterialSliderUI .class .getCanonicalName ();
55
+ private static final String toolBarUI = MaterialToolBarUI .class .getCanonicalName ();
56
+ private static final String comboBoxUI = MaterialComboBoxUI .class .getCanonicalName ();
57
+ private static final String sliderUI = MaterialSliderUI .class .getCanonicalName ();
57
58
private static final String progressBarUI = MaterialProgressBarUI .class .getCanonicalName ();
59
+
60
+
58
61
59
62
public static String getProgressbarui () {
60
63
return progressBarUI ;
@@ -119,9 +122,8 @@ protected void initClassDefaults (UIDefaults table) {
119
122
table .put ("TabbedPaneUI" , tabbedPaneUI );
120
123
table .put ("ToggleButtonUI" , toggleButtonUI );
121
124
table .put ("ScrollBarUI" , scrollBarUI );
125
+ table .put ("ToolBarUI" , toolBarUI );
122
126
table .put ("ComboBoxUI" , comboBoxUI );
123
- table .put ("PopupMenuUI" , popupMenuUI );
124
- table .put ("ToolBarUI" , toolbarUI );
125
127
table .put ("SliderUI" , sliderUI );
126
128
table .put ("ProgressBarUI" , progressBarUI );
127
129
}
@@ -130,150 +132,44 @@ protected void initClassDefaults (UIDefaults table) {
130
132
protected void initComponentDefaults (UIDefaults table ) {
131
133
super .initComponentDefaults (table );
132
134
133
- table .put ("Button.highlight" , MaterialColors .GRAY_200 );
134
- table .put ("Button.opaque" , false );
135
- table .put ("Button.border" , BorderFactory .createEmptyBorder (7 , 17 , 7 , 17 ));
136
- table .put ("Button.background" , MaterialColors .LIGHT_BLUE_400 );
137
- table .put ("Button.foreground" , Color .WHITE );
138
- table .put ("Button.font" , MaterialFonts .MEDIUM );
139
-
140
- table .put ("CheckBox.font" , MaterialFonts .REGULAR );
141
- table .put ("CheckBox.background" , Color .WHITE );
142
- table .put ("CheckBox.foreground" , Color .BLACK );
143
- table .put ("CheckBox.icon" , new ImageIcon (MaterialImages .UNCHECKED_BOX ));
144
- table .put ("CheckBox.selectedIcon" , new ImageIcon (MaterialImages .PAINTED_CHECKED_BOX ));
145
-
146
135
table .put ("ComboBox.font" , MaterialFonts .REGULAR );
147
- table .put ("ComboBox.background" , Color .WHITE );
148
- table .put ("ComboBox.foreground" , Color .BLACK );
149
- table .put ("ComboBox.border" , BorderFactory .createCompoundBorder (MaterialBorders .LIGHT_LINE_BORDER , BorderFactory .createEmptyBorder (0 , 5 , 0 , 0 )));
150
- table .put ("ComboBox.buttonBackground" , MaterialColors .GRAY_300 );
151
- table .put ("ComboBox.selectionBackground" , Color .WHITE );
152
- table .put ("ComboBox.selectionForeground" , Color .BLACK );
153
- table .put ("ComboBox.selectedInDropDownBackground" , MaterialColors .GRAY_200 );
154
-
155
- table .put ("Label.font" , MaterialFonts .REGULAR );
156
- table .put ("Label.background" , Color .WHITE );
157
- table .put ("Label.foreground" , Color .BLACK );
158
- table .put ("Label.border" , BorderFactory .createEmptyBorder ());
159
-
160
- table .put ("Menu.font" , MaterialFonts .BOLD );
161
- table .put ("Menu.border" , BorderFactory .createEmptyBorder (5 , 5 , 5 , 5 ));
162
- table .put ("Menu.background" , Color .WHITE );
163
- table .put ("Menu.foreground" , Color .BLACK );
164
- table .put ("Menu.opaque" , true );
165
- table .put ("Menu.selectionBackground" , MaterialColors .GRAY_200 );
166
- table .put ("Menu.selectionForeground" , Color .BLACK );
167
- table .put ("Menu.disabledForeground" , new Color (0 , 0 , 0 , 100 ));
168
- table .put ("Menu.menuPopupOffsetY" , 3 );
169
-
170
- table .put ("MenuBar.font" , MaterialFonts .BOLD );
171
- table .put ("MenuBar.background" , Color .WHITE );
172
- table .put ("MenuBar.border" , MaterialBorders .LIGHT_SHADOW_BORDER );
173
- table .put ("MenuBar.foreground" , Color .BLACK );
136
+ table .put ("OptionPane.font" , MaterialFonts .REGULAR );
137
+ table .put ("ScrollPane.font" , MaterialFonts .REGULAR );
138
+ table .put ("TextArea.font" , MaterialFonts .REGULAR );
174
139
175
140
table .put ("MenuItem.disabledForeground" , new Color (0 , 0 , 0 , 100 ));
176
141
table .put ("MenuItem.selectionBackground" , MaterialColors .GRAY_200 );
177
142
table .put ("MenuItem.selectionForeground" , Color .BLACK );
178
- table .put ("MenuItem.font" , MaterialFonts .MEDIUM );
179
- table .put ("MenuItem.background" , Color .WHITE );
180
- table .put ("MenuItem.foreground" , Color .BLACK );
181
- table .put ("MenuItem.border" , BorderFactory .createEmptyBorder (5 , 0 , 5 , 0 ));
182
-
183
- table .put ("OptionPane.background" , Color .WHITE );
184
- table .put ("OptionPane.border" , MaterialBorders .DEFAULT_SHADOW_BORDER );
185
- table .put ("OptionPane.font" , MaterialFonts .REGULAR );
186
-
187
- table .put ("Panel.font" , MaterialFonts .REGULAR );
188
- table .put ("Panel.background" , Color .WHITE );
189
- table .put ("Panel.border" , BorderFactory .createEmptyBorder ());
190
143
191
- table .put ("PopupMenu.border" , MaterialBorders . LIGHT_LINE_BORDER );
144
+ table .put ("PopupMenu.border" , BorderFactory . createLineBorder ( MaterialColors . GRAY_200 , 1 ) );
192
145
table .put ("PopupMenu.background" , Color .WHITE );
193
- table .put ("PopupMenu.foreground" , Color .BLACK );
194
146
195
- table .put ("RadioButton.font" , MaterialFonts .REGULAR );
196
- table .put ("RadioButton.background" , Color .WHITE );
197
- table .put ("RadioButton.foreground" , Color .BLACK );
198
- table .put ("RadioButton.icon" , new ImageIcon (MaterialImages .RADIO_BUTTON_OFF ));
199
- table .put ("RadioButton.selectedIcon" , new ImageIcon (MaterialImages .RADIO_BUTTON_ON ));
200
-
201
- table .put ("Spinner.font" , MaterialFonts .REGULAR );
202
- table .put ("Spinner.background" , Color .WHITE );
203
- table .put ("Spinner.foreground" , Color .BLACK );
204
- table .put ("Spinner.border" , MaterialBorders .LIGHT_LINE_BORDER );
205
- table .put ("Spinner.arrowButtonBackground" , MaterialColors .GRAY_200 );
206
- table .put ("Spinner.arrowButtonBorder" , BorderFactory .createEmptyBorder ());
207
-
208
- table .put ("ScrollBar.font" , MaterialFonts .REGULAR );
209
- table .put ("ScrollBar.track" , MaterialColors .GRAY_200 );
210
- table .put ("ScrollBar.thumb" , MaterialColors .GRAY_300 );
211
- table .put ("ScrollBar.thumbDarkShadow" , MaterialColors .GRAY_300 );
212
- table .put ("ScrollBar.thumbHighlight" , MaterialColors .GRAY_300 );
213
- table .put ("ScrollBar.thumbShadow" , MaterialColors .GRAY_300 );
214
- table .put ("ScrollBar.arrowButtonBackground" , MaterialColors .GRAY_300 );
215
- table .put ("ScrollBar.arrowButtonBorder" , BorderFactory .createEmptyBorder ());
216
-
217
- table .put ("ScrollPane.background" , Color .WHITE );
218
- table .put ("ScrollPane.border" , BorderFactory .createEmptyBorder ());
219
- table .put ("ScrollPane.font" , MaterialFonts .REGULAR );
220
-
221
- table .put ("Slider.font" , MaterialFonts .REGULAR );
222
- table .put ("Slider.background" , Color .WHITE );
223
- table .put ("Slider.foreground" , MaterialColors .LIGHT_BLUE_400 );
224
- table .put ("Slider.trackColor" , Color .BLACK );
225
- table .put ("Slider.border" , BorderFactory .createCompoundBorder (MaterialBorders .LIGHT_LINE_BORDER , BorderFactory .createEmptyBorder (20 , 20 , 20 , 20 )));
147
+ table .put ("Menu.selectionBackground" , MaterialColors .GRAY_200 );
148
+ table .put ("Menu.selectionForeground" , Color .BLACK );
149
+ table .put ("Menu.disabledForeground" , new Color (0 , 0 , 0 , 100 ));
150
+ table .put ("Menu.menuPopupOffsetY" , 3 );
226
151
227
152
table .put ("SplitPane.border" , BorderFactory .createEmptyBorder ());
228
153
table .put ("SplitPane.background" , Color .WHITE );
229
154
table .put ("SplitPane.dividerSize" , 5 );
230
155
table .put ("SplitPaneDivider.border" , BorderFactory .createEmptyBorder ());
231
156
232
- table .put ("TabbedPane.font" , MaterialFonts .REGULAR );
233
- table .put ("TabbedPane.background" , Color .WHITE );
234
- table .put ("TabbedPane.foreground" , Color .BLACK );
235
- table .put ("TabbedPane.border" , BorderFactory .createEmptyBorder ());
236
- table .put ("TabbedPane.shadow" , null );
237
- table .put ("TabbedPane.darkShadow" , null );
238
- table .put ("TabbedPane.highlight" , MaterialColors .GRAY_200 );
239
- table .put ("TabbedPane.borderHighlightColor" , MaterialColors .GRAY_300 );
240
-
241
- table .put ("Table.selectionBackground" , MaterialColors .GRAY_100 );
242
- table .put ("Table.selectionForeground" , Color .BLACK );
243
- table .put ("Table.background" , Color .WHITE );
244
- table .put ("Table.font" , MaterialFonts .REGULAR );
245
- table .put ("Table.border" , MaterialBorders .LIGHT_LINE_BORDER );
246
- table .put ("Table.gridColor" , MaterialColors .GRAY_200 );
247
- table .put ("TableHeader.background" , MaterialColors .GRAY_200 );
248
- table .put ("TableHeader.font" , MaterialFonts .BOLD );
249
- table .put ("TableHeader.cellBorder" , BorderFactory .createCompoundBorder (MaterialBorders .LIGHT_LINE_BORDER , BorderFactory .createEmptyBorder (10 , 10 , 10 , 10 )));
157
+ table .put ("ScrollPane.background" , Color .WHITE );
158
+ table .put ("ScrollPane.border" , BorderFactory .createEmptyBorder ());
250
159
251
160
table .put ("TextArea.background" , MaterialColors .GRAY_200 );
252
161
table .put ("TextArea.border" , BorderFactory .createEmptyBorder ());
253
162
table .put ("TextArea.foreground" , Color .BLACK );
254
163
255
- table .put ("ToggleButton.border" , BorderFactory .createEmptyBorder ());
256
- table .put ("ToggleButton.font" , MaterialFonts .REGULAR );
257
- table .put ("ToggleButton.background" , Color .WHITE );
258
- table .put ("ToggleButton.foreground" , Color .BLACK );
259
- table .put ("ToggleButton.icon" , new ImageIcon (MaterialImages .TOGGLE_BUTTON_OFF ));
260
- table .put ("ToggleButton.selectedIcon" , new ImageIcon (MaterialImages .TOGGLE_BUTTON_ON ));
261
-
262
- table .put ("ToolBar.font" , MaterialFonts .REGULAR );
263
- table .put ("ToolBar.background" , Color .WHITE );
264
- table .put ("ToolBar.foreground" , Color .BLACK );
265
- table .put ("ToolBar.border" , MaterialBorders .LIGHT_SHADOW_BORDER );
266
- table .put ("ToolBar.dockingBackground" , MaterialColors .LIGHT_GREEN_A100 );
267
- table .put ("ToolBar.floatingBackground" , MaterialColors .GRAY_200 );
164
+ table .put ("OptionPane.background" , Color .WHITE );
165
+ table .put ("OptionPane.border" , MaterialBorders .DEFAULT_SHADOW_BORDER );
268
166
269
- table .put ("Tree.font" , MaterialFonts .REGULAR );
270
- table .put ("Tree.selectionForeground" , Color .BLACK );
271
- table .put ("Tree.foreground" , Color .BLACK );
272
- table .put ("Tree.selectionBackground" , MaterialColors .GRAY_200 );
273
- table .put ("Tree.background" , Color .WHITE );
274
- table .put ("Tree.closedIcon" , new ImageIcon (MaterialImages .RIGHT_ARROW ));
275
- table .put ("Tree.openIcon" , new ImageIcon (MaterialImages .DOWN_ARROW ));
276
- table .put ("Tree.selectionBorderColor" , null );
167
+ table .put ("Button.highlight" , MaterialColors .GRAY_200 );
168
+
169
+ table .put ("Slider.trackWidth" , 20 ); //Value tmp
170
+ table .put ("Slider.majorTickLength" , 20 ); //value tmp
171
+ table .put ("Slider.horizontalThumbIcon" , new ImageIcon (MaterialImages .SLIDER_POINT ));
172
+ table .put ("Slider.verticalThumbIcon" , new ImageIcon (MaterialImages .SLIDER_POINT ));
277
173
}
278
174
279
175
0 commit comments