小型工资管理系统 java 报告书(7)

2019-06-11 10:55

ButtonGroup buttonGroup1=new ButtonGroup(); JButton jButton1=new JButton(\添加职工\ //构造方法

public AddEmployee() { }

//界面初始化方法

private void jbInit() throws Exception {

//连接数据库

con=DBConnect.getConn(); st=con.createStatement(); //框架的布局 this.setLayout(null); //设置各组件的大小 try{ }

catch(Exception exception){ }

exception.printStackTrace(); //调用初始化方法 jbInit();

jLabel1.setBounds(new Rectangle(21,17,64,24)); jLabel2.setBounds(new Rectangle(21,51,53,22)); jLabel3.setBounds(new Rectangle(21,86,61,27)); jLabel4.setBounds(new Rectangle(21,122,59,25)); jLabel5.setBounds(new Rectangle(21,168,54,24)); jLabel6.setBounds(new Rectangle(21,205,54,24)); jTextField1.setBounds(new Rectangle(102,10,200,30)); jTextField2.setBounds(new Rectangle(102,49,200,30)); jTextField3.setBounds(new Rectangle(102,117,80,33)); jTextField4.setBounds(new Rectangle(102,163,200,29)); jTextField5.setBounds(new Rectangle(102,200,200,29)); jRadioButton1.setBounds(new Rectangle(102,83,65,30)); jRadioButton2.setBounds(new Rectangle(190,85,85,30)); jButton1.setBounds(new Rectangle(130,240,150,32)); //设置单选按钮被选中 jRadioButton1.setSelected(true); //添加按钮动作事件

jButton1.addActionListener(this); //添加组件到面板 this.add(jLabel1); this.add(jTextField1); this.add(jLabel2);

}

this.add(jTextField2); this.add(jLabel3);

buttonGroup1.add(jRadioButton1); buttonGroup1.add(jRadioButton2); this.add(jRadioButton1); this.add(jRadioButton2); this.add(jLabel4); this.add(jTextField3); this.add(jLabel5); this.add(jTextField4); this.add(jLabel6); this.add(jTextField5); this.add(jButton1);

//点击按钮事件

public void actionPerformed(ActionEvent e) {

//获取用户输入的信息

String EmployeeID=jTextField1.getText(); String EmployeeName=jTextField2.getText(); String EmployeeSex=\if(jRadioButton1.isSelected())

EmployeeSex+=\男\

if(jRadioButton2.isSelected())

EmployeeSex+=\女\

String EmployeeAge=jTextField3.getText(); String EmployeeAddress=jTextField4.getText(); String EmployeePhone=jTextField5.getText(); try{

//设置日期格式

st.execute(\

//利用st对象执行SQL语句,进行插入操作 st.executeUpdate(\

values('\mployeeAge+\

功!\

//清空文本行的内容 jTextField1.setText(\jTextField2.setText(\jTextField3.setText(\jTextField4.setText(\jTextField5.setText(\

//利用消息对话框提示职工添加成功

JOptionPane.showMessageDialog(this,\职工添加成

}

catch(Exception ex){

//利用消息对话框提示异常的信息

JOptionPane.showMessageDialog(this,\职工添加失

败!\

ex.printStackTrace();

}

} }

职工信息修改系统源代码

//“职工信息修改”面板类ModifyEmployee //导入系统的类包 import java.awt.*; import java.sql.*; import javax.swing.*; import java.awt.event.*; //创建“职工信息修改资”类

public class ModifyEmployee extends JPanel ActionListener

{

//声明连接数据库对象

implements


小型工资管理系统 java 报告书(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:四川省眉山市东坡区眉山中学2015届高三上学期2月月考历史试卷

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: