-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautomaticTable.java
More file actions
23 lines (23 loc) · 1.21 KB
/
automaticTable.java
File metadata and controls
23 lines (23 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
final void getData() {
MongoCollection coll = MongoUtil.getCollection("testq");
documents = coll.find();
String[] columnNames = {"Test Description", "Course Code", "Date", "Time", "Open/Closed"};
DefaultTableModel model = new DefaultTableModel(columnNames, 0);
int counter = 0;
for (Document obj : documents) {
String testTitle = (String) obj.get("Title");
String courseCode = (String) obj.get("course_code");
String dateS = obj.getString("Date");
String timeS = obj.getString("Time");
Date date = createDateFromDateTime(dateS, timeS);
String openORclosed = (String) obj.get("Closed/Open");
Object duratation = obj.get("Duration");
ObjectId id = (ObjectId) obj.get("_id");
model.addRow(new Object[]{testTitle, courseCode, date, duratation, openORclosed});
// table.getTableHeader().setFont(new Font(Font.SERIF, Font.BOLD, 20));
// table.getTableHeader().setBackground(new Color(122,71,221));
}
table.setModel(model);
table.setTableHeader(null);
//table.setIntercellSpacing(new Dimension (10,20));
}