- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentDisplayPanel.java
More file actions
Latest commit
58 lines (47 loc) · 1.36 KB
/
Copy pathStudentDisplayPanel.java
File metadata and controls
58 lines (47 loc) · 1.36 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
packagecom.cruds.swingproj;
importjava.awt.CardLayout;
importjava.awt.event.ActionEvent;
importjava.awt.event.ActionListener;
importjava.awt.event.ComponentAdapter;
importjava.awt.event.ComponentEvent;
importjava.util.Vector;
importjavax.swing.JButton;
importjavax.swing.JPanel;
importjavax.swing.JScrollPane;
importjavax.swing.JTable;
importjavax.swing.table.DefaultTableModel;
publicclassStudentDisplayPanelextendsJPanel
{
JTablestable;
JScrollPanescrollpane;
JButtonbtnhome;
Vector<String> colNames;
Vector<Vector<String>> data;
BookDAOdao = newBookDAO();
publicStudentDisplayPanel()
{
colNames = newVector<>();
colNames.add("Student USN");
colNames.add("Student Name");
data = dao.getStudentDetails();
stable = newJTable(data,colNames);
scrollpane = newJScrollPane(stable);
add(scrollpane);
addComponentListener(newComponentAdapter() {
@Override
publicvoidcomponentShown(ComponentEvente)
{
stable.setModel(newDefaultTableModel(dao.getStudentDetails(),colNames));
}
});
btnhome = newJButton("Home");
btnhome.addActionListener(newActionListener() {
@Override
publicvoidactionPerformed(ActionEvente) {
CardLayoutcard = (CardLayout) getParent().getLayout();
card.show(getParent(),"HOMEPANEL");
}
});
add(btnhome);
}
}