package Stu;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class UpdateGUI extends JFrame implements ActionListener,MouseListener,ItemListener {
private static final long serialVersionUID = 1L;
JTable table ;
JScrollPane scrollpane;
JRadioButton jr1,jr2,jr3,jr4,jr5;
JButton jbt;
JPanel jpnorth,jpsouth,jpYuanxi,jpClass,jpSubject,jpStu,jpScore;
JButton jbYXQuery,jbYXAdd,jbYXUpdate,jbYXDelete,//院系设置按钮
jbCLSQuery,jbCLSAdd,jbCLSUpdate,jbCLSDelete,
jbSUBQuery,jbSUBAdd,jbSUBUpdate,jbSUBXDelete,
jbSTUQuery,jbSTUAdd,jbSTUUpdate,jbSTUDelete,
jbSCOQuery,jbSCOAdd,jbSCOUpdate,jbSCODelete;
// 院系设置 标签
JLabel jlYXID,jlYXName,jlYXYuan,
jlCLSID,jlCLS,jlCLSYX,
jlSUBID,jlSUBName,jlSUBSome,
jlSTUID,jlSTUName,jlSTUSex, jlSTUITime, jlSTUBirthd,jlSTUPhone,jlSTUAddr,jlSTUCls,
jlSCOID,jlSCOSID,jlSCOSName, jlSCOUID, jlSCOUName,jlSCOUSC,jlSCOTime,jlSCORem;
//课程设置 文本框
JTextField jtYXID,jtYXName,jtYXYuan,
jtCLSID,jtCLS,jtCLSYX,
jtSUBID,jtSUBName,jtSUBSome,
jtSTUID,jtSTUName,jtSTUSex, jtSTUITime, jtSTUBirthd,jtSTUPhone,jtSTUAddr,jtSTUCls,
jtSCOID,jtSCOSID,jtSCOSName, jtSCOUID, jtSCOUName,jtSCOUSC,jtSCOTime,jtSCORem;
CardLayout clo;
int isSelectRadio =0;//设置选中的单选框
String theID;
operStu oper = new operStu();
////////////////以上声明部分
UpdateGUI() throws Exception {
table = new JTable();
//table = new JTable(new tableModel(""));
table.addMouseListener(this);
scrollpane = new JScrollPane(table);
//窗体设置
this.setLayout(new BorderLayout());
this.add(addNorth(),BorderLayout.NORTH);//添加上面板
this.add(addSouth(),BorderLayout.SOUTH);//添加下面板
this.add(scrollpane);
this.setTitle("学生管理系统");
this.setSize(700,400);
this.setVisible(true);
}
JPanel addNorth() {
jpnorth = new JPanel();
ButtonGroup bg = new ButtonGroup();
jr1 = new JRadioButton("院系管理",true);
jr2 = new JRadioButton("班级管理");
jr3 = new JRadioButton("课程管理");
jr4 = new JRadioButton("学生管理");
jr5 = new JRadioButton("成绩管理");
jr1.addItemListener(this);
jr2.addItemListener(this);
jr3.addItemListener(this);
jr4.addItemListener(this);
jr5.addItemListener(this);
bg.add(jr1);
bg.add(jr2);
bg.add(jr3);
bg.add(jr4);
bg.add(jr5);
jpnorth.add(jr1);
jpnorth.add(jr2);
jpnorth.add(jr3);
jpnorth.add(jr4);
jpnorth.add(jr5);
jbt = new JButton("查看");
jbt.addActionListener(this);
jpnorth.add(jbt);
return jpnorth;
}
JPanel addSouth() {
jpsouth = new JPanel();
clo = new CardLayout();
jpsouth.setLayout(clo);
jpsouth.add("院系管理",addYuanxi());
jpsouth.add("班级管理",addClass());
jpsouth.add("课程管理",addSubject());
jpsouth.add("学生管理", addStu() );
jpsouth.add("成绩管理",addScore());
return jpsouth;
}
JPanel addYuanxi()
{
/*院系操作面板
* jlYXID,jlYXName,jlYXYuan;
* JTextField jtYXID,jtYXName,jtYXYuan,
* JButton jbYXQuery,jbYXAdd,jbYXUpdate,jbYXDelete
*/
jpYuanxi = new JPanel();//院系操作面板,增删改查
jpYuanxi.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
jlYXID = new JLabel("系编号");
gbc.gridx=0;
gbc.gridy=0;
jpYuanxi.add(jlYXID,gbc);
jtYXID = new JTextField("",7);
gbc.gridx=1;
gbc.gridy=0;
jpYuanxi.add(jtYXID,gbc);
gbc.gridx=2;
gbc.gridy=0;
jlYXName = new JLabel("系名");
jpYuanxi.add(jlYXName,gbc);//标签
jtYXName = new JTextField("",7);
gbc.gridx=3;
gbc.gridy=0;
jpYuanxi.add(jtYXName,gbc);//文本
jlYXYuan = new JLabel("所属学院");
gbc.gridx=4;
gbc.gridy=0;
jpYuanxi.add(jlYXYuan,gbc);//添加到面板
jtYXYuan = new JTextField("",7);
gbc.gridx=5;
gbc.gridy=0;
jpYuanxi.add(jtYXYuan,gbc);//文本3
jbYXQuery = new JButton("查询");
jbYXQuery.addActionListener(this);
gbc.gridx=1;
gbc.gridy=1;
jpYuanxi.add(jbYXQuery,gbc);//添加按钮
jbYXAdd = new JButton("添加");
jbYXAdd.addActionListener(this);
gbc.gridx=2;
gbc.gridy=1;
jpYuanxi.add(jbYXAdd,gbc);//添加按钮
jbYXUpdate = new JButton("修改");
jbYXUpdate.addActionListener(this);
gbc.gridx=3;
gbc.gridy=1;
jpYuanxi.add(jbYXUpdate,gbc);//添加按钮
jbYXDelete = new JButton("删除");
jbYXDelete.addActionListener(this);
gbc.gridx=4;
gbc.gridy=1;
jpYuanxi.add(jbYXDelete,gbc);//添加按钮
return jpYuanxi;
}
JPanel addClass() {
/*班级操作面板
* jlCLSID,jlCLS,jlCLSYX,
* jtCLSID,jtCLS,jtCLSYX,
* jbCLSQuery,jbCLSAdd,jbCLSUpdate,jbCLSDelete,
*/
jpClass = new JPanel();//院系操作面板,增删改查
jpClass.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
jlCLSID = new JLabel("班级编号");
gbc.gridx=0;
gbc.gridy=0;
jpClass.add(jlCLSID,gbc);
jtCLSID = new JTextField("",7);
gbc.gridx=1;
gbc.gridy=0;
jpClass.add(jtCLSID,gbc);
gbc.gridx=2;
gbc.gridy=0;
jlCLS = new JLabel("班级名");
jpClass.add(jlCLS,gbc);//标签
jtCLS = new JTextField("",7);
gbc.gridx=3;
gbc.gridy=0;
jpClass.add(jtCLS,gbc);//文本
jlCLSYX = new JLabel("所在系");
gbc.gridx=4;
gbc.gridy=0;
jpClass.add(jlCLSYX,gbc);//添加到面板
jtCLSYX = new JTextField("",7);
gbc.gridx=5;
gbc.gridy=0;
jpClass.add(jtCLSYX,gbc);//文本3
jbCLSQuery = new JButton("查询");
jbCLSQuery.addActionListener(this);
gbc.gridx=1;
gbc.gridy=1;
jpClass.add(jbCLSQuery,gbc);//查询按钮
jbCLSAdd = new JButton("添加");
jbCLSAdd.addActionListener(this);
gbc.gridx=2;
gbc.gridy=1;
jpClass.add(jbCLSAdd,gbc);//添加按钮
jbCLSUpdate = new JButton("修改");
jbCLSUpdate.addActionListener(this);
gbc.gridx=3;
gbc.gridy=1;
jpClass.add(jbCLSUpdate,gbc);//修改按钮
jbCLSDelete = new JButton("删除");
jbCLSDelete.addActionListener(this);
gbc.gridx=4;
gbc.gridy=1;
jpClass.add(jbCLSDelete,gbc);//删除按钮
return jpClass;
}
JPanel addSubject() {
/*课程操作面板
*jbSUBQuery,jbSUBAdd,jbSUBUpdate,jbSUBXDelete,
*jlSUBID,jlSUBName,jlSUBSome,
*jtSUBID,jtSUBName,jtSUBSome,
*/
jpSubject = new JPanel();//院系操作面板,增删改查
jpSubject.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
jlSUBID = new JLabel("课程编号");
gbc.gridx=0;
gbc.gridy=0;
jpSubject.add(jlSUBID,gbc);
jtSUBID = new JTextField("",7);
gbc.gridx=1;
gbc.gridy=0;
jpSubject.add(jtSUBID,gbc);
gbc.gridx=2;
gbc.gridy=0;
jlSUBName = new JLabel("课程名");
jpSubject.add(jlSUBName,gbc);//标签
jtSUBName = new JTextField("",7);
gbc.gridx=3;
gbc.gridy=0;
jpSubject.add(jtSUBName,gbc);//文本
jlSUBSome = new JLabel("备注");
gbc.gridx=4;
gbc.gridy=0;
jpSubject.add(jlSUBSome,gbc);//添加到面板
jtSUBSome = new JTextField("",7);
gbc.gridx=5;
gbc.gridy=0;
jpSubject.add(jtSUBSome,gbc);//文本3
jbSUBQuery = new JButton("查询");
jbSUBQuery.addActionListener(this);
gbc.gridx=1;
gbc.gridy=1;
jpSubject.add(jbSUBQuery,gbc);//查询按钮
jbSUBAdd = new JButton("添加");
jbSUBAdd.addActionListener(this);
gbc.gridx=2;
gbc.gridy=1;
jpSubject.add(jbSUBAdd,gbc);//添加按钮
jbSUBUpdate = new JButton("修改");
jbSUBUpdate.addActionListener(this);
gbc.gridx=3;
gbc.gridy=1;
jpSubject.add(jbSUBUpdate,gbc);//修改按钮
jbSUBXDelete = new JButton("删除");
jbSUBXDelete.addActionListener(this);
gbc.gridx=4;
gbc.gridy=1;
jpSubject.add(jbSUBXDelete,gbc);//删除按钮
return jpSubject;
}
JPanel addStu() {
/*课程操作面板
*jbSTUQuery,jbSTUAdd,jbSTUUpdate,jbSTUDelete,
*jlSTUID,jlSTUName,jlSTUSex, jlSTUITime, jlSTUBirthd,jl