File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 14
14
import javax .swing .JPasswordField ;
15
15
import javax .swing .JRadioButton ;
16
16
import javax .swing .JScrollPane ;
17
+ import javax .swing .JProgressBar ;
17
18
import javax .swing .JSlider ;
18
19
import javax .swing .JSpinner ;
19
20
import javax .swing .JTabbedPane ;
@@ -91,6 +92,12 @@ public static void main (String[] args) {
91
92
JSlider sliderVertical = new JSlider (JSlider .VERTICAL );
92
93
content .add (slider );
93
94
content .add (sliderVertical );
95
+
96
+ //test Progressbar
97
+ JProgressBar progressBar = new JProgressBar ();
98
+ progressBar .setMaximum (5 );
99
+ progressBar .setValue (2 );
100
+ content .add (progressBar );
94
101
95
102
// add everything to the frame
96
103
frame .add (bar , BorderLayout .PAGE_START );
Original file line number Diff line number Diff line change 10
10
import mdlaf .components .panel .MaterialPanelUI ;
11
11
import mdlaf .components .password .MaterialPasswordFieldUI ;
12
12
import mdlaf .components .popupmenu .MaterialPopupMenuUI ;
13
+ import mdlaf .components .progressbar .MaterialProgressBarUI ;
13
14
import mdlaf .components .radiobutton .MaterialRadioButtonUI ;
14
15
import mdlaf .components .scrollbar .MaterialScrollBarUI ;
15
16
import mdlaf .components .slider .MaterialSliderUI ;
@@ -53,6 +54,13 @@ public class MaterialLookAndFeel extends MetalLookAndFeel {
53
54
private static final String popupMenuUI = MaterialPopupMenuUI .class .getCanonicalName ();
54
55
private static final String toolbarUI = MaterialToolBarUI .class .getCanonicalName ();
55
56
private static final String sliderUI = MaterialSliderUI .class .getCanonicalName ();
57
+ private static final String progressBarUI = MaterialProgressBarUI .class .getCanonicalName ();
58
+
59
+ public static String getProgressbarui () {
60
+ return progressBarUI ;
61
+ }
62
+
63
+
56
64
57
65
public static String getSliderui () {
58
66
return sliderUI ;
@@ -115,6 +123,7 @@ protected void initClassDefaults (UIDefaults table) {
115
123
table .put ("PopupMenuUI" , popupMenuUI );
116
124
table .put ("ToolBarUI" , toolbarUI );
117
125
table .put ("SliderUI" , sliderUI );
126
+ table .put ("ProgressBarUI" , progressBarUI );
118
127
}
119
128
120
129
@ Override
Original file line number Diff line number Diff line change
1
+ package mdlaf .components .progressbar ;
2
+
3
+ import java .awt .Graphics ;
4
+
5
+ import javax .swing .JComponent ;
6
+ import javax .swing .JProgressBar ;
7
+ import javax .swing .plaf .ComponentUI ;
8
+ import javax .swing .plaf .basic .BasicProgressBarUI ;
9
+
10
+ import mdlaf .resources .MaterialBorders ;
11
+ import mdlaf .resources .MaterialColors ;
12
+ import mdlaf .resources .MaterialDrawingUtils ;
13
+
14
+ public class MaterialProgressBarUI extends BasicProgressBarUI {
15
+
16
+ public static ComponentUI createUI (JComponent c ) {
17
+ return new MaterialProgressBarUI ();
18
+ }
19
+
20
+ @ Override
21
+ public void installUI (JComponent c ) {
22
+ super .installUI (c );
23
+ if (c instanceof JProgressBar ) {
24
+ JProgressBar progressBar = (JProgressBar )c ;
25
+ progressBar .setBackground (MaterialColors .GRAY_300 );
26
+ progressBar .setBorder (MaterialBorders .LIGHT_LINE_BORDER );
27
+ progressBar .setForeground (MaterialColors .LIGHT_BLUE_A400 );
28
+ }
29
+
30
+ }
31
+
32
+ @ Override
33
+ public void paint (Graphics g , JComponent c ) {
34
+ // TODO Auto-generated method stub
35
+ super .paint (MaterialDrawingUtils .getAliasedGraphics (g ), c );
36
+ }
37
+
38
+
39
+
40
+ }
You can’t perform that action at this time.
0 commit comments