/*
* StudentModifyInterFrm.java
*
* Created on __DATE__, __TIME__
*/
package com.DMView;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import com.DMModel.Room;
import com.DMModel.Student;
import com.DMUtil.DMUtil;
import com.Dao.RoomDao;
import com.Dao.StudentDao;
/**
*
* @author __USER__
*/
public class StudentModifyInterFrm extends javax.swing.JInternalFrame {
DMUtil dmutil = new DMUtil();
RoomDao roomdao = new RoomDao();
StudentDao studentdao = new StudentDao();
/** Creates new form StudentModifyInterFrm */
public StudentModifyInterFrm() {
initComponents();
this.setLocation(160, 50);
this.fillTable(new Student());
this.fillRoom();
this.jb_man.setSelected(true);
}
public void fillRoom() {
Connection con = null;
Room room = new Room();
try {
con = dmutil.getCon();
ResultSet rs = roomdao.roomList(con, room);
Room room2 = new Room();
room2.setMember("请选择...");
room2.setId(-1 + "");
this.jcb_room.addItem(room2);
while (rs.next()) {
room = new Room();
room.setId(rs.getInt("id") + "");
room.setMember(rs.getString("member"));
room.setLeader(rs.getString("leader"));
this.jcb_room.addItem(room);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
dmutil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
private void fillTable(Student student) {
DefaultTableModel dtm = (DefaultTableModel) table.getModel();
dtm.setRowCount(0);
Connection con = null;
try {
con = dmutil.getCon();
ResultSet rs = studentdao.StudentSearch(con, student);
while (rs.next()) {
Vector v = new Vector();
v.add(rs.getString("id"));
v.add(rs.getString("name"));
v.add(rs.getString("sex"));
v.add(rs.getString("yuanxi"));
v.add(rs.getString("classroom"));
v.add(rs.getString("member"));
v.add(rs.getString("bed"));
dtm.addRow(v);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
dmutil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jLabel1 = new javax.swing.JLabel();
nameTxt = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
classTxt = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
yuanxiTxt = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
bedTxt = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jb_man = new javax.swing.JRadioButton();
jb_women = new javax.swing.JRadioButton();
jLabel6 = new javax.swing.JLabel();
jcb_room = new javax.swing.JComboBox();
jScrollPane1 = new javax.swing.JScrollPane();
table = new javax.swing.JTable();
jb_modify = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel7 = new javax.swing.JLabel();
idTxt = new javax.swing.JTextField();
setClosable(true);
setIconifiable(true);
setTitle("\u5b66\u751f\u4fe1\u606f\u4fee\u6539");
jLabel1.setText("\u59d3\u540d\uff1a");
jLabel2.setText("\u73ed\u7ea7\uff1a");
jLabel3.setText("\u9662\u7cfb\uff1a");
jLabel4.setText("\u5e8a\u53f7\uff1a");
jLabel5.setText("\u6027\u522b\uff1a");
buttonGroup1.add(jb_man);
jb_man.setText("\u7537");
buttonGroup1.add(jb_women);
jb_women.setText("\u5973");
jLabel6.setText("\u5bdd\u5ba4\u53f7\uff1a");
table.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"编号", "姓名", "性别", "院系", "班级", "寝室号", "床号"
}
) {
boolean[] canEdit = new boolean [] {
false, false, false, false, false, false, false
};
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
table.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(java.awt.event.MouseEvent evt) {
tableMousePressed(evt);
}
});
jScrollPane1.setViewportView(table);
jb_modify.setIcon(new javax.swing.ImageIcon("D:\\Myelipse\\images4\\modify.png")); // NOI18N
jb_modify.setText("\u4fee\u6539");
jb_modify.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jb_modifyActionPerformed(evt);
}
});
jButton2.setIcon(new javax.swing.ImageIcon("D:\\Myelipse\\images4\\exit.png")); // NOI18N
jButton2.setText("\u9000\u51fa");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel7.setText("\u7f16\u53f7\uff1a");
idTxt.setEditable(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(32, 32, 32)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(nameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bedTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(8, 8, 8)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jb_man, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jb_women, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jcb_room, 0, 160, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(4, 4, 4)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(classTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(yuanxiTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(idTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE)))
.addGap(49, 49, 49))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 621, Short.MAX_VALUE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(217, Short.MAX_VALUE)
.addComponent(jb_modify)
.addGap(119, 119, 119)
.addComponent(jButton2)
.addGap(151, 151, 151))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentia
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论











收起资源包目录





































































































共 128 条
- 1
- 2
资源评论


奔跑的乌龟
- 粉丝: 94
- 资源: 4
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


安全验证
文档复制为VIP权益,开通VIP直接复制
