20
20
import java .awt .event .ActionEvent ;
21
21
import java .awt .event .ActionListener ;
22
22
import javax .swing .*;
23
- import java .awt .*;
23
+ import java .io .IOException ;
24
+ import java .text .DateFormat ;
25
+ import java .text .ParseException ;
26
+ import java .text .SimpleDateFormat ;
24
27
import java .time .LocalDate ;
28
+ import java .util .Date ;
25
29
import ser .admin .IntAdmin ;
26
30
import ser .ui .IntUI ;
27
31
import java .util .List ;
32
+ import java .util .Locale ;
33
+ import java .util .logging .Level ;
34
+ import java .util .logging .Logger ;
35
+ import javafx .scene .control .DatePicker ;
28
36
29
37
/**
30
38
*
31
39
* @author Parth Doshi
32
40
*/
33
41
34
42
public class AdminGUI extends JFrame implements IntUI ,ActionListener {
35
- JFrame f1 ;
43
+ // JFrame f1;
36
44
JButton [] jb1 =new JButton [6 ];
37
45
JButton [] jb2 ;
38
46
JLabel [] jl ;
47
+ JTextField jtf ;
39
48
LocalDate date ;
40
49
final IntAdmin ia ;
41
50
public AdminGUI (IntAdmin ia ){
51
+ new JFrame ("Software-Monitor" );
52
+ setLayout (new GridLayout (3 , 2 ));
42
53
this .ia =ia ;
43
- List <String > abc = ia .getAllUname (LocalDate .MIN );
54
+ jtf =new JTextField ();
55
+ String sdate =jtf .getText ();
56
+ try {
57
+ date = LocalDate .of (new Integer (sdate .substring (0 , 4 )).intValue (), new Integer (sdate .substring (5 , 7 )).intValue (), new Integer (sdate .substring (8 )).intValue ());
58
+ } catch (Exception ex ) {
59
+ Logger .getLogger (AdminGUI .class .getName ()).log (Level .SEVERE , null , ex );
60
+ }
61
+ List <String > abc = ia .getAllUname (date );
44
62
jl = new JLabel [abc .size ()];
45
63
jb2 = new JButton [abc .size ()];
46
64
int i = 0 ;
47
- JPanel p1 =new JPanel (new FlowLayout ());
48
- JPanel p2 =new JPanel (new GridLayout (300 , 2 ));
65
+ JPanel p1 =new JPanel (new GridLayout (2 , 4 ));
66
+ JPanel p2 =new JPanel (new GridLayout (abc .size (), 2 ));
67
+ final DatePicker dp = new DatePicker ();
68
+
49
69
for (String username :abc )
50
70
{
51
71
jl [i ] = new JLabel (username );
@@ -58,6 +78,7 @@ public void actionPerformed(ActionEvent e) {
58
78
ListPage lp =new ListPage (ia ,username ,date );
59
79
}
60
80
});
81
+ i ++;
61
82
}
62
83
63
84
jb1 [1 ]=new JButton ("Update" );
@@ -103,10 +124,8 @@ public void actionPerformed(ActionEvent e) {
103
124
ia .stopSer ();
104
125
}
105
126
});
106
- f1 = new JFrame ("Software-Monitor" );
107
- f1 .setLayout (new GridLayout (3 , 2 ));
108
- f1 .add (p1 );
109
- f1 .add (p2 );
127
+ add (p1 );
128
+ add (p2 );
110
129
p1 .add (jb1 [1 ]);
111
130
p1 .add (jb1 [5 ]);
112
131
p1 .add (jb1 [6 ]);
@@ -117,10 +136,11 @@ public void actionPerformed(ActionEvent e) {
117
136
jb1 [2 ].setEnabled (true );
118
137
jb1 [3 ].setEnabled (false );
119
138
jb1 [4 ].setEnabled (false );
120
-
121
- f1 .setVisible (false );
122
- f1 .setSize (500 , 400 );
123
- f1 .setDefaultCloseOperation (JFrame .EXIT_ON_CLOSE );
139
+ setExtendedState (JFrame .MAXIMIZED_BOTH );
140
+ setUndecorated (true );
141
+ setVisible (false );
142
+ setSize (500 , 400 );
143
+ setDefaultCloseOperation (JFrame .EXIT_ON_CLOSE );
124
144
125
145
}
126
146
@@ -155,16 +175,20 @@ public String showPrompt(String msg) {
155
175
156
176
@ Override
157
177
public void start () {
158
- f1 . setVisible (true );
178
+ setVisible (true );
159
179
}
160
180
161
181
@ Override
162
182
public void actionPerformed (ActionEvent e ) {
163
183
throw new UnsupportedOperationException ("Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
164
184
}
165
185
166
- public static void main (String [] args ) {
167
- AdminGUI ag =new AdminGUI (null );
186
+ @ Override
187
+ public void close () throws IOException {
188
+ throw new UnsupportedOperationException ("Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
168
189
}
169
190
191
+ public static void main (String [] args ) {
192
+ AdminGUI ag =new AdminGUI ();
193
+ }
170
194
}
0 commit comments