2020import java .awt .event .ActionEvent ;
2121import java .awt .event .ActionListener ;
2222import 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 ;
2427import java .time .LocalDate ;
28+ import java .util .Date ;
2529import ser .admin .IntAdmin ;
2630import ser .ui .IntUI ;
2731import 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 ;
2836
2937/**
3038 *
3139 * @author Parth Doshi
3240 */
3341
3442public class AdminGUI extends JFrame implements IntUI ,ActionListener {
35- JFrame f1 ;
43+ // JFrame f1;
3644 JButton [] jb1 =new JButton [6 ];
3745 JButton [] jb2 ;
3846 JLabel [] jl ;
47+ JTextField jtf ;
3948 LocalDate date ;
4049 final IntAdmin ia ;
4150 public AdminGUI (IntAdmin ia ){
51+ new JFrame ("Software-Monitor" );
52+ setLayout (new GridLayout (3 , 2 ));
4253 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 );
4462 jl = new JLabel [abc .size ()];
4563 jb2 = new JButton [abc .size ()];
4664 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+
4969 for (String username :abc )
5070 {
5171 jl [i ] = new JLabel (username );
@@ -58,6 +78,7 @@ public void actionPerformed(ActionEvent e) {
5878 ListPage lp =new ListPage (ia ,username ,date );
5979 }
6080 });
81+ i ++;
6182 }
6283
6384 jb1 [1 ]=new JButton ("Update" );
@@ -103,10 +124,8 @@ public void actionPerformed(ActionEvent e) {
103124 ia .stopSer ();
104125 }
105126 });
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 );
110129 p1 .add (jb1 [1 ]);
111130 p1 .add (jb1 [5 ]);
112131 p1 .add (jb1 [6 ]);
@@ -117,10 +136,11 @@ public void actionPerformed(ActionEvent e) {
117136 jb1 [2 ].setEnabled (true );
118137 jb1 [3 ].setEnabled (false );
119138 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 );
124144
125145 }
126146
@@ -155,16 +175,20 @@ public String showPrompt(String msg) {
155175
156176 @ Override
157177 public void start () {
158- f1 . setVisible (true );
178+ setVisible (true );
159179 }
160180
161181 @ Override
162182 public void actionPerformed (ActionEvent e ) {
163183 throw new UnsupportedOperationException ("Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
164184 }
165185
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.
168189 }
169190
191+ public static void main (String [] args ) {
192+ AdminGUI ag =new AdminGUI ();
193+ }
170194}
0 commit comments