-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathStudentProfileCopy.java
More file actions
158 lines (125 loc) · 4.33 KB
/
Copy pathStudentProfileCopy.java
File metadata and controls
158 lines (125 loc) · 4.33 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
import java.awt.EventQueue;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextPane;
import javax.swing.border.EmptyBorder;
public class StudentProfileCopy extends JFrame {
private JPanel contentPane;
private JLabel lblStudentProfileName;
private JLabel lblStudentProfileId;
private JLabel lblMajor;
private JLabel lblStatus;
private JLabel lblStudentProfile;
private JLabel lblUxxxxxxx;
private JLabel lblComputerScience;
private JLabel lblUndergraduate;
private JLabel lblComments;
private String name;
private String ID;
private String major;
private String status;
private JTable table;
private String[] columnNames;
private Object[][] data;
/**
*
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
StudentInfo s = new StudentInfo(-1, "Miranda Rivera", "U79852612", "Computer Science", "undergraduate");
StudentProfileCopy frame = new StudentProfileCopy(s);
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
//this must be searched on database and turned into a StudentInfo object before calling this class
//Receive Student object and extract information
public void GetStudent(StudentInfo s) {
name = s.getName();
ID = s.getID();
major = s.getMajor();
status = s.getStatus();
//missing the assignment array etc.
LoadTableData(s);
}
/**database manager class
* function that takes in id of column and takes student info and turns into StudentInfo class
* function that takes in a student info and updates by overriding info for that student in database
*/
//student must have assignment array
public void LoadTableData(StudentInfo s) {
// TODO : Load the assignments from student
columnNames = new String[]{"Assignment",
"Weight",
"Grade"};
data = new Object[][] {
{"Homework1", new Float(0.5), new Float(90.0)},
{"Homework2", new Float(0.5), new Float(90.0)},
{"Homework3", new Float(0.5), new Float(90.0)},
{"Homework4", new Float(0.5), new Float(90.0)},
{"Homework5", new Float(0.5), new Float(90.0)},
};
}
/**
* Create the frame.
*/
public StudentProfileCopy(StudentInfo s) {
GetStudent(s);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
lblStudentProfileName = new JLabel("Student Name: ");
lblStudentProfileName.setBounds(6, 5, 96, 16);
contentPane.add(lblStudentProfileName);
lblStudentProfile = new JLabel(name); // change to student.Name
lblStudentProfile.setBounds(133, 5, 200, 16);
contentPane.add(lblStudentProfile);
lblStudentProfileId = new JLabel("Student ID: ");
lblStudentProfileId.setBounds(6, 26, 96, 16);
contentPane.add(lblStudentProfileId);
lblUxxxxxxx = new JLabel(ID); // change to student.Id
lblUxxxxxxx.setBounds(133, 26, 200, 16);
contentPane.add(lblUxxxxxxx);
lblMajor = new JLabel("Major: ");
lblMajor.setBounds(6, 47, 96, 16);
contentPane.add(lblMajor);
lblComputerScience = new JLabel(major); // change to student.Major
lblComputerScience.setBounds(133, 47, 200, 16);
contentPane.add(lblComputerScience);
lblStatus = new JLabel("Status: ");
lblStatus.setBounds(6, 68, 96, 16);
contentPane.add(lblStatus);
lblUndergraduate = new JLabel(status); // change to student.Status
lblUndergraduate.setBounds(133, 68, 200, 16);
contentPane.add(lblUndergraduate);
lblComments = new JLabel("Comments");
lblComments.setBounds(293, 5, 74, 16);
contentPane.add(lblComments);
JTextPane txtpnComment = new JTextPane();
txtpnComment.setBounds(293, 26, 133, 101);
contentPane.add(txtpnComment);
JButton btnSave = new JButton("Save");
btnSave.setBounds(176, 246, 96, 26);
contentPane.add(btnSave);
table = new JTable(data, columnNames);
table.setBounds(18, 135, 408, 101);
//contentPane.add(table);
JScrollPane scrollPane = new JScrollPane(table);
scrollPane.setBounds(18, 135, 408, 101);
table.setFillsViewportHeight(true);
contentPane.add(scrollPane);
}
}