-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0Student.java
More file actions
68 lines (58 loc) · 2.48 KB
/
Copy path0Student.java
File metadata and controls
68 lines (58 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cdvirtualclient;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
/**
*
* @author Chayan-Dhaddha
*/
public class Student extends JFrame{
JTabbedPane tab;
StudentUpcomingSession panel_upcoming_session;
StudentPastSession panel_past_session;
Dimension size;
public Student()
{
Toolkit tool=Toolkit.getDefaultToolkit();
size=tool.getScreenSize();
//final int WIDTH=700;
//final int HEIGHT=600;
this.setVisible(true);
this.setBounds(0,0,size.width,size.height);
this.setTitle("Student");
this.setResizable(false);
this.setLayout(null);
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
panel_upcoming_session=new StudentUpcomingSession();
panel_past_session=new StudentPastSession();
tab=new JTabbedPane();
tab.addTab("Upcoming Sessions",panel_upcoming_session);
tab.addTab("Past Sessions",panel_past_session);
this.design();
this.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
if(JOptionPane.showConfirmDialog(Student.this,"Do you want to logout??","Confirmation",JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION){
try{
ObjectOutputStream out=new ObjectOutputStream(CommResource.client.getOutputStream());
out.writeObject(Resource.RequestCodes.LOGOUT);
System.exit(0);
}catch(Exception ex){
}
}
}
});
}
void design(){
setPosition(tab,5,50,size.width,size.height);
}
void setPosition(Component C,int x,int y,int w,int h){
this.add(C);
C.setBounds(x,y,w,h);
}
}