package tool;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
import javax.swing.*;
class AllRun extends JFrame
implements ActionListener
{
JLabel JL =new JLabel("查询/修改/添加/删除教师基本信息",JLabel.CENTER);
JLabel JLNumber =new JLabel("请输入教师编号:");
JTextField JTNumber =new JTextField();
JLabel JLName =new JLabel("姓名:");
JTextField JTName =new JTextField();
JLabel JLsex =new JLabel("性别");
ButtonGroup BG1 =new ButtonGroup();
JRadioButton JRB1 =new JRadioButton("男");
JRadioButton JRB2 =new JRadioButton("女");
JLabel JLmarry =new JLabel("婚姻状态");
ButtonGroup BG2 =new ButtonGroup();
JRadioButton JRB3 =new JRadioButton("已婚");
JRadioButton JRB4 =new JRadioButton("未婚");
JLabel JLpl =new JLabel("政治面貌");
ButtonGroup BG3 =new ButtonGroup();
JRadioButton JRB5 =new JRadioButton("清白");
JRadioButton JRB6 =new JRadioButton("团员");
JRadioButton JRB7 =new JRadioButton("党员");
JLabel JL1 =new JLabel("年龄");
JTextField JT1 =new JTextField();
JLabel JL2 =new JLabel("出生年月");
JTextField JT2 =new JTextField();
JLabel JL3 =new JLabel("学历");
JTextField JT3 =new JTextField();
JLabel JL4 =new JLabel("部门编号");
JTextField JT4 =new JTextField();
JLabel JL5 =new JLabel("职务");
JTextField JT5 =new JTextField();
JLabel JL6 =new JLabel("联系方式");
JTextField JT6=new JTextField();
//JLabel JL7 =new JLabel("奖惩编号");
//JTextField JT7 =new JTextField();
JLabel JLNote =new JLabel("备注");
JTextArea JTNote =new JTextArea();
JLabel JL7 =new JLabel("部门名称");
JTextField JT7=new JTextField();
JLabel JL8 =new JLabel("部门人数");
JTextField JT8=new JTextField();
JLabel JL9 =new JLabel("奖惩编号");
JTextField JT9=new JTextField();
JLabel JL10 =new JLabel("奖惩时间");
JTextField JT10=new JTextField();
JLabel JL11 =new JLabel("奖惩原因");
JTextField JT11=new JTextField();
JLabel JL12 =new JLabel("奖罚地点");
JTextField JT12=new JTextField();
JLabel JLNote2 =new JLabel("奖惩备注");
JTextArea JTNote2 =new JTextArea();
JButton JBSet =new JButton("查询");
JButton JBNext =new JButton("重置");
JButton JBExit =new JButton("退出");
JButton JBUpdate =new JButton("修改");
JButton JBAdd =new JButton("添加");
JButton JBDel =new JButton("删除");
JButton JBLook =new JButton("查看结果");
Connection con;
//Statement sql;
ResultSet rs;
String sql="";
public AllRun()
{
this.setTitle("查询/修改/添加/删除教师信息");
this.setLayout(null);
JL.setFont(new Font("TimesRoman",Font.BOLD,24));
JL.setForeground(Color.green);
JL.setFont(new Font("宋体",Font.PLAIN,19));
this.setResizable(false); //窗口大小不可改变
this.setDefaultCloseOperation(DISPOSE_ON_CLOSE); //设置关闭窗口
JL.setBounds(100, 30, 500, 40);
this.add(JL);
JLNumber.setBounds(100, 80, 80, 20);
this.add(JLNumber);
JTNumber.setBounds(200, 80, 100, 20);
this.add(JTNumber);
JLName.setBounds(100, 120, 60, 20);
this.add(JLName);
JTName.setBounds(200, 120, 100, 20);
this.add(JTName);
JL1.setBounds(100, 160, 60, 20);
this.add(JL1);
JT1.setBounds(200, 160, 100, 20);
this.add(JT1);
JLsex.setBounds(100, 200, 100, 20);
this.add(JLsex);
JRB1.setBounds(200, 200, 40, 20);
JRB2.setBounds(260, 200, 40, 20);
this.add(JRB1);
this.add(JRB2);
BG1.add(JRB1);
BG1.add(JRB2);
JL2.setBounds(100, 240, 60, 20);
this.add(JL2);
JT2.setBounds(200, 240, 100, 20);
this.add(JT2);
JLmarry.setBounds(100, 280, 40, 20);
this.add(JLmarry);
JRB3.setBounds(200, 280, 80, 20);
JRB4.setBounds(280, 280, 80, 20);
this.add(JRB3);
this.add(JRB4);
BG2.add(JRB3);
BG2.add(JRB4);
JLpl.setBounds(100, 320, 60, 20);
this.add(JLpl);
JRB5.setBounds(200, 320, 80, 20);
JRB6.setBounds(300, 320, 80, 20);
JRB7.setBounds(400, 320, 80, 20);
this.add(JRB5);
this.add(JRB6);
this.add(JRB7);
BG3.add(JRB5);
BG3.add(JRB6);
BG3.add(JRB7);
JL3.setBounds(100, 360, 60, 20);
this.add(JL3);
JT3.setBounds(200, 360, 100, 20);
this.add(JT3);
JL4.setBounds(100, 400, 60, 20);
this.add(JL4);
JT4.setBounds(200, 400, 100, 20);
this.add(JT4);
JL5.setBounds(100, 440, 90, 20);
this.add(JL5);
JT5.setBounds(200, 440, 100, 20);
this.add(JT5);
JL6.setBounds(100, 480, 60, 20);
this.add(JL6);
JT6.setBounds(200, 480, 100, 20);
this.add(JT6);
//JL7.setBounds(100, 520, 60, 20);
// this.add(JL7);
// JT7.setBounds(200, 520, 100, 20);
// this.add(JT7);
JLNote.setBounds(100, 520, 100, 60);
this.add(JLNote);
JTNote.setBounds(200, 520, 400, 60);
this.add(JTNote);
//2
JL7.setBounds(500, 100, 60, 20);
this.add(JL7);
JT7.setBounds(600, 100, 100, 20);
this.add(JT7);
JL8.setBounds(500, 140, 60, 20);
this.add(JL8);
JT8.setBounds(600, 140, 100, 20);
this.add(JT8);
JL9.setBounds(500, 180, 60, 20);
this.add(JL9);
JT9.setBounds(600, 180, 100, 20);
this.add(JT9);
JL10.setBounds(500, 220, 60, 20);
this.add(JL10);
JT10.setBounds(600, 220, 100, 20);
this.add(JT10);
JL11.setBounds(500, 260, 60, 20);
this.add(JL11);
JT11.setBounds(600, 260, 100, 20);
this.add(JT11);
JL12.setBounds(500, 300, 60, 20);
this.add(JL12);
JT12.setBounds(600, 300, 100, 20);
this.add(JT12);
JLNote2.setBounds(500, 360, 60, 60);
this.add(JLNote2);
JTNote2.setBounds(600, 360, 400, 60);
this.add(JTNote2);
JBSet.setBounds(80, 620, 90, 20);
this.add(JBSet);
JBSet.addActionListener(this);
JBUpdate.setBounds(190, 620, 90, 20);
this.add(JBUpdate);
JBUpdate.addActionListener(this);
JBAdd.setBounds(300, 620, 90, 20);
this.add(JBAdd);
JBAdd.addActionListener(this);
JBDel.setBounds(410, 620, 90, 20);
this.add(JBDel);
JBDel.addActionListener(this);
JBNext.setBounds(510, 620, 90, 20);
this.add(JBNext);
JBNext.addActionListener(this);
JBLook.setBounds(610, 620, 90, 20);
this.add(JBLook);
JBLook.addActionListener(this);
JBExit.setBounds(710, 620, 90, 20);
this.add(JBExit);
JBExit.addActionListener(this);
this.setBounds(30,30,1000,700);
this.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==JBSet)
{
String snumber=JTNumber.getText();
String sname=JTName.getText();
/*String ssex="女",sql;
if(JRB1.isSelected()) ssex="男";
//else ssex="女";
String sl1=JT1.getText();
String sl2=JT2.getText();
String sl3=JT3.getText();
String sl4=JT4.getText();
String sl5=JT5.getText();
String sl6=JT6.getText();*/
//sql="select * from teacher where Id='"+snumber+"'";
try
{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
}catch(ClassNotFoundException ev){
JOptionPane.showMessageDialog(this, "connction error");
}
try{
con=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;databaseName=高校教职工管理(L)_new;user=LZF;password=LZF");
sql="select * from 员工信息表,部门信息表,奖励信息表 where 员工信息表.员工编号=奖励信息表.员工编号