2
2
import mdlaf .animation .MaterialUIMovement ;
3
3
import mdlaf .resources .MaterialColors ;
4
4
5
- import javax .swing .*;
6
- import java .awt .*;
7
- import java .awt .event .ActionEvent ;
5
+ import javax .swing .JButton ;
6
+ import javax .swing .JCheckBox ;
7
+ import javax .swing .JCheckBoxMenuItem ;
8
+ import javax .swing .JComboBox ;
9
+ import javax .swing .JEditorPane ;
10
+ import javax .swing .JFileChooser ;
11
+ import javax .swing .JFrame ;
12
+ import javax .swing .JLabel ;
13
+ import javax .swing .JMenu ;
14
+ import javax .swing .JMenuBar ;
15
+ import javax .swing .JMenuItem ;
16
+ import javax .swing .JPanel ;
17
+ import javax .swing .JPasswordField ;
18
+ import javax .swing .JProgressBar ;
19
+ import javax .swing .JRadioButton ;
20
+ import javax .swing .JRadioButtonMenuItem ;
21
+ import javax .swing .JScrollPane ;
22
+ import javax .swing .JSlider ;
23
+ import javax .swing .JSpinner ;
24
+ import javax .swing .JTabbedPane ;
25
+ import javax .swing .JTable ;
26
+ import javax .swing .JTextField ;
27
+ import javax .swing .JTextPane ;
28
+ import javax .swing .JToggleButton ;
29
+ import javax .swing .JToolBar ;
30
+ import javax .swing .JTree ;
31
+ import javax .swing .SpinnerListModel ;
32
+ import javax .swing .UIManager ;
33
+ import javax .swing .UnsupportedLookAndFeelException ;
34
+ import java .awt .BorderLayout ;
35
+ import java .awt .Color ;
36
+ import java .awt .Dimension ;
8
37
9
38
public class MaterialUISwingDemo {
10
39
@@ -30,15 +59,15 @@ public static void main (String[] args) {
30
59
JMenuItem item2 = new JMenuItem ("Item 2 (Not animated)" );
31
60
32
61
//Test RadioButtonMenuItem
33
- JRadioButtonMenuItem jRadioButtonMenuItem = new JRadioButtonMenuItem ();
34
- jRadioButtonMenuItem .setText ("prova RadioButtonMenuItem" );
35
- menu1 .add (jRadioButtonMenuItem );
36
- menu1 .addSeparator ();
62
+ JRadioButtonMenuItem jRadioButtonMenuItem = new JRadioButtonMenuItem ();
63
+ jRadioButtonMenuItem .setText ("prova RadioButtonMenuItem" );
64
+ menu1 .add (jRadioButtonMenuItem );
65
+ menu1 .addSeparator ();
37
66
//TestCheckBoxMenuItem
38
- JCheckBoxMenuItem checkBoxMenuItem = new JCheckBoxMenuItem ();
39
- checkBoxMenuItem .setText ("test" );
40
- menu1 .add (checkBoxMenuItem );
41
- menu1 .addSeparator ();
67
+ JCheckBoxMenuItem checkBoxMenuItem = new JCheckBoxMenuItem ();
68
+ checkBoxMenuItem .setText ("test" );
69
+ menu1 .add (checkBoxMenuItem );
70
+ menu1 .addSeparator ();
42
71
menu1 .add (item1 );
43
72
menu2 .add (item2 );
44
73
@@ -47,6 +76,8 @@ public static void main (String[] args) {
47
76
48
77
// configuring a simple JButton
49
78
JButton button = new JButton ("PRESS ME" );
79
+ button .setBackground (MaterialColors .LIGHT_BLUE_400 );
80
+ button .setForeground (Color .WHITE );
50
81
button .setMaximumSize (new Dimension (200 , 200 ));
51
82
52
83
JPanel content = new JPanel ();
@@ -80,9 +111,15 @@ public static void main (String[] args) {
80
111
content .add (new JToggleButton ("toggle" ));
81
112
82
113
JToolBar tb = new JToolBar ("toolbar" );
83
- tb .add (new JButton ("f" ));
114
+ JButton button1 = new JButton ("f" );
115
+ JButton button2 = new JButton ("e" );
116
+ button1 .setBackground (MaterialColors .LIGHT_BLUE_400 );
117
+ button1 .setForeground (Color .WHITE );
118
+ button2 .setBackground (MaterialColors .LIGHT_BLUE_400 );
119
+ button2 .setForeground (Color .WHITE );
120
+ tb .add (button1 );
84
121
tb .addSeparator ();
85
- tb .add (new JButton ( "e" ) );
122
+ tb .add (button2 );
86
123
tb .setFloatable (true );
87
124
content .add (tb );
88
125
@@ -95,39 +132,42 @@ public static void main (String[] args) {
95
132
sp .setHorizontalScrollBarPolicy (JScrollPane .HORIZONTAL_SCROLLBAR_ALWAYS );
96
133
sp .setVerticalScrollBarPolicy (JScrollPane .VERTICAL_SCROLLBAR_ALWAYS );
97
134
98
- JPanel pn = new JPanel ();
135
+ JPanel pn = new JPanel ();
99
136
JTabbedPane tp = new JTabbedPane ();
100
137
tp .addTab ("bleh1" , pn );
101
138
tp .addTab ("bleh" , sp );
102
139
103
140
frame .add (tp , BorderLayout .CENTER );
104
-
141
+
105
142
//test progressBar
106
- JProgressBar progressBar = new JProgressBar ();
107
- progressBar .setValue (6 );
108
- progressBar .setMaximum (12 );
109
- pn .add (progressBar );
143
+ JProgressBar progressBar = new JProgressBar ();
144
+ progressBar .setValue (6 );
145
+ progressBar .setMaximum (12 );
146
+ pn .add (progressBar );
110
147
111
148
//test cange coloro maximum value progress bar
112
- progressBar = new JProgressBar ();
113
- progressBar .setMaximum (5 );
114
- progressBar .setValue (5 );
115
- pn .add (progressBar );
116
-
117
- JTextPane textPane = new JTextPane ();
118
- textPane .setText ("Hi I'm super sayan" );
119
- JTextPane textPane1 = new JTextPane ();
120
- textPane1 .setText ("Hi I'm super sayan" );
121
- textPane1 .setEnabled (false );
122
- pn .add (textPane );
123
- pn .add (textPane1 );
124
-
125
- JEditorPane editorPane = new JEditorPane ();
126
- editorPane .setText ("This theme is fantastic" );
127
- pn .add (editorPane );
149
+ progressBar = new JProgressBar ();
150
+ progressBar .setMaximum (5 );
151
+ progressBar .setValue (5 );
152
+ pn .add (progressBar );
153
+
154
+ JTextPane textPane = new JTextPane ();
155
+ textPane .setText ("Hi I'm super sayan" );
156
+ JTextPane textPane1 = new JTextPane ();
157
+ textPane1 .setText ("Hi I'm super sayan" );
158
+ textPane1 .setEnabled (false );
159
+ pn .add (textPane );
160
+ pn .add (textPane1 );
161
+
162
+ JEditorPane editorPane = new JEditorPane ();
163
+ editorPane .setText ("This theme is fantastic" );
164
+ pn .add (editorPane );
128
165
129
166
// make everything visible to the world
130
167
frame .pack ();
131
168
frame .setVisible (true );
169
+
170
+ JFileChooser fileChooser = new JFileChooser ();
171
+ fileChooser .showOpenDialog (frame );
132
172
}
133
173
}
0 commit comments