Skip to content

Commit 678f1f0

Browse files
committed
Initial commit
0 parents  commit 678f1f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1071
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

README.md

+17
41.1 KB
43.3 KB

bin/add1.png

2.77 KB

bin/addstd.png

33.7 KB

bin/cancel.png

3.45 KB

bin/del.png

38.3 KB

bin/exit.png

5.25 KB

bin/project.class/Add$1.class

704 Bytes
Binary file not shown.

bin/project.class/Add$2.class

704 Bytes
Binary file not shown.

bin/project.class/Add$3.class

672 Bytes
Binary file not shown.

bin/project.class/Add$4.class

672 Bytes
Binary file not shown.

bin/project.class/Add$5.class

704 Bytes
Binary file not shown.

bin/project.class/Add$6.class

506 Bytes
Binary file not shown.

bin/project.class/Add.class

10.8 KB
Binary file not shown.

bin/project.class/Admin.class

741 Bytes
Binary file not shown.

bin/project.class/Delete$1.class

693 Bytes
Binary file not shown.

bin/project.class/Delete$2.class

693 Bytes
Binary file not shown.

bin/project.class/Delete$3.class

693 Bytes
Binary file not shown.

bin/project.class/Delete$4.class

518 Bytes
Binary file not shown.

bin/project.class/Delete.class

8.77 KB
Binary file not shown.

bin/project.class/Login$1.class

718 Bytes
Binary file not shown.

bin/project.class/Login$2.class

686 Bytes
Binary file not shown.

bin/project.class/Login$3.class

718 Bytes
Binary file not shown.

bin/project.class/Login$4.class

514 Bytes
Binary file not shown.

bin/project.class/Login.class

6.21 KB
Binary file not shown.

bin/project.class/Main3$1.class

686 Bytes
Binary file not shown.

bin/project.class/Main3$2.class

686 Bytes
Binary file not shown.

bin/project.class/Main3$3.class

514 Bytes
Binary file not shown.

bin/project.class/Main3.class

4.94 KB
Binary file not shown.

bin/project.class/MyConnection.class

1.03 KB
Binary file not shown.

bin/project.class/ProjectJava.class

503 Bytes
Binary file not shown.

bin/project.class/Student.class

3.6 KB
Binary file not shown.
41.1 KB
43.3 KB

res/add1.png

2.77 KB

res/addstd.png

33.7 KB

res/cancel.png

3.45 KB

res/del.png

38.3 KB

res/exit.png

5.25 KB

src/Add.java

+318
Large diffs are not rendered by default.

src/Admin.java

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* To change this license header, choose License Headers in Project Properties.
3+
* To change this template file, choose Tools | Templates
4+
* and open the template in the editor.
5+
*/
6+
package labnerd;
7+
8+
/**
9+
*
10+
* @author NONT
11+
*/
12+
public class Admin {
13+
private String ussername="";
14+
private String password="";
15+
16+
/**
17+
* @return the ussername
18+
*/
19+
public String getUssername() {
20+
return ussername;
21+
}
22+
23+
/**
24+
* @param ussername the ussername to set
25+
*/
26+
public void setUssername(String ussername) {
27+
this.ussername = ussername;
28+
}
29+
30+
/**
31+
* @return the password
32+
*/
33+
public String getPassword() {
34+
return password;
35+
}
36+
37+
/**
38+
* @param password the password to set
39+
*/
40+
public void setPassword(String password) {
41+
this.password = password;
42+
}
43+
}

src/Delete.java

+217
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
/*
2+
* To change this license header, choose License Headers in Project Properties.
3+
* To change this template file, choose Tools | Templates
4+
* and open the template in the editor.
5+
*/
6+
package labnerd;
7+
8+
import javax.swing.JOptionPane;
9+
import javax.swing.table.DefaultTableModel;
10+
11+
/**
12+
*
13+
* @author NONT
14+
*/
15+
public class Delete extends javax.swing.JFrame {
16+
17+
/**
18+
* Creates new form Delete
19+
*/
20+
Student std = new Student();
21+
private Object NameTextField;
22+
public Delete() {
23+
initComponents();
24+
std.fillStudentJtable(jTable1, ""); //เรียกใช้ตารางข้อมูล
25+
}
26+
27+
/**
28+
* This method is called from within the constructor to initialize the form.
29+
* WARNING: Do NOT modify this code. The content of this method is always
30+
* regenerated by the Form Editor.
31+
*/
32+
@SuppressWarnings("unchecked")
33+
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
34+
private void initComponents() {
35+
36+
jPanel1 = new javax.swing.JPanel();
37+
jPanel3 = new javax.swing.JPanel();
38+
jLabel9 = new javax.swing.JLabel();
39+
jLabelDelete = new javax.swing.JLabel();
40+
jScrollPane1 = new javax.swing.JScrollPane();
41+
jTable1 = new javax.swing.JTable();
42+
jTextField_STD_ID = new javax.swing.JTextField();
43+
44+
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
45+
setLocation(new java.awt.Point(300, 200));
46+
setResizable(false);
47+
setSize(new java.awt.Dimension(1280, 720));
48+
49+
jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/labnerd/exit.png"))); // NOI18N
50+
jLabel9.addMouseListener(new java.awt.event.MouseAdapter() {
51+
public void mouseClicked(java.awt.event.MouseEvent evt) {
52+
jLabel9MouseClicked(evt);
53+
}
54+
});
55+
56+
jLabelDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/labnerd/cancel.png"))); // NOI18N
57+
jLabelDelete.addMouseListener(new java.awt.event.MouseAdapter() {
58+
public void mouseClicked(java.awt.event.MouseEvent evt) {
59+
jLabelDeleteMouseClicked(evt);
60+
}
61+
});
62+
63+
jTable1.setFont(new java.awt.Font("Bangna New", 0, 16)); // NOI18N
64+
jTable1.setModel(new javax.swing.table.DefaultTableModel(
65+
new Object [][] {
66+
67+
},
68+
new String [] {
69+
"Student Number", "First Name", "Last Name", "Sex", "Birth Day"
70+
}
71+
));
72+
jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
73+
public void mouseClicked(java.awt.event.MouseEvent evt) {
74+
jTable1MouseClicked(evt);
75+
}
76+
});
77+
jScrollPane1.setViewportView(jTable1);
78+
79+
jTextField_STD_ID.setEditable(false);
80+
81+
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
82+
jPanel3.setLayout(jPanel3Layout);
83+
jPanel3Layout.setHorizontalGroup(
84+
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
85+
.addGroup(jPanel3Layout.createSequentialGroup()
86+
.addContainerGap()
87+
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1268, Short.MAX_VALUE)
88+
.addContainerGap())
89+
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
90+
.addGap(19, 19, 19)
91+
.addComponent(jLabel9)
92+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
93+
.addComponent(jTextField_STD_ID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
94+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
95+
.addComponent(jLabelDelete)
96+
.addGap(26, 26, 26))
97+
);
98+
jPanel3Layout.setVerticalGroup(
99+
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
100+
.addGroup(jPanel3Layout.createSequentialGroup()
101+
.addContainerGap()
102+
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
103+
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
104+
.addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING)
105+
.addComponent(jLabelDelete, javax.swing.GroupLayout.Alignment.TRAILING))
106+
.addComponent(jTextField_STD_ID, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE))
107+
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
108+
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 611, Short.MAX_VALUE)
109+
.addGap(39, 39, 39))
110+
);
111+
112+
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
113+
jPanel1.setLayout(jPanel1Layout);
114+
jPanel1Layout.setHorizontalGroup(
115+
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
116+
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
117+
);
118+
jPanel1Layout.setVerticalGroup(
119+
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
120+
.addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
121+
);
122+
123+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
124+
getContentPane().setLayout(layout);
125+
layout.setHorizontalGroup(
126+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
127+
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
128+
);
129+
layout.setVerticalGroup(
130+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
131+
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
132+
);
133+
134+
pack();
135+
}// </editor-fold>//GEN-END:initComponents
136+
137+
// โชว์ข้อมูล แก้ไขได้
138+
private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
139+
// TODO add your handling code here:
140+
int rowIndex = jTable1.getSelectedRow();
141+
DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
142+
143+
jTextField_STD_ID.setText(model.getValueAt(rowIndex,0).toString());
144+
145+
}//GEN-LAST:event_jTable1MouseClicked
146+
147+
private void jLabelDeleteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelDeleteMouseClicked
148+
149+
// TODO add your handling code here:
150+
if(jTextField_STD_ID.getText().equals("")){
151+
JOptionPane.showMessageDialog(null, "No Student Selected");
152+
}
153+
else{
154+
int id = Integer.valueOf(jTextField_STD_ID.getText());
155+
std.insert('d', id, null, null, null, null,null);
156+
std.fillStudentJtable(jTable1, "");
157+
Delete delete = new Delete();
158+
delete.setVisible(true);
159+
System.out.println("Pass");
160+
this.setVisible(false);
161+
162+
}
163+
}//GEN-LAST:event_jLabelDeleteMouseClicked
164+
165+
private void jLabel9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel9MouseClicked
166+
// TODO add your handling code here:
167+
Main3 main = new Main3();
168+
main.setVisible(true);
169+
System.out.println("Pass");
170+
this.setVisible(false);
171+
}//GEN-LAST:event_jLabel9MouseClicked
172+
173+
/**
174+
* @param args the command line arguments
175+
*/
176+
public static void main(String args[]) {
177+
/* Set the Nimbus look and feel */
178+
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
179+
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
180+
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
181+
*/
182+
try {
183+
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
184+
if ("Nimbus".equals(info.getName())) {
185+
javax.swing.UIManager.setLookAndFeel(info.getClassName());
186+
break;
187+
}
188+
}
189+
} catch (ClassNotFoundException ex) {
190+
java.util.logging.Logger.getLogger(Delete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
191+
} catch (InstantiationException ex) {
192+
java.util.logging.Logger.getLogger(Delete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
193+
} catch (IllegalAccessException ex) {
194+
java.util.logging.Logger.getLogger(Delete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
195+
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
196+
java.util.logging.Logger.getLogger(Delete.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
197+
}
198+
//</editor-fold>
199+
200+
/* Create and display the form */
201+
java.awt.EventQueue.invokeLater(new Runnable() {
202+
public void run() {
203+
new Delete().setVisible(true);
204+
}
205+
});
206+
}
207+
208+
// Variables declaration - do not modify//GEN-BEGIN:variables
209+
private javax.swing.JLabel jLabel9;
210+
private javax.swing.JLabel jLabelDelete;
211+
private javax.swing.JPanel jPanel1;
212+
private javax.swing.JPanel jPanel3;
213+
private javax.swing.JScrollPane jScrollPane1;
214+
private javax.swing.JTable jTable1;
215+
private javax.swing.JTextField jTextField_STD_ID;
216+
// End of variables declaration//GEN-END:variables
217+
}

0 commit comments

Comments
 (0)