版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
bm.javaimportjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjavax.swing.*;classbmextendsFrameimplementsActionListener,ItemListener{privatecondbconx=null;privateResultSetrs=null;privateStringsql=null;privateLabelnum=newLabel("职工号");privateLabeljb=newLabel("税收");privateLabelfj=newLabel("医疗保险");privateLabelin=newLabel("退休保险");privateTextFieldnumtx=newTextField();privateTextFieldjbtx=newTextField();privateTextFieldfjtx=newTextField();privateTextFieldintx=newTextField();privateChoicenumcho=newChoice();privateButtonadd=newButton("增加");privateButtonexit=newButton("退出");publicbm(){setTitle("扣除工资");setSize(400,300);setBackground(Color.LIGHT_GRAY);this.setLocationRelativeTo(this.getParent());this.setResizable(false);setLayout(null);num.setBounds(80,50,50,20);jb.setBounds(80,80,50,20);fj.setBounds(80,110,50,20);in.setBounds(80,140,50,20);numtx.setBounds(160,50,100,20);jbtx.setBounds(160,80,100,20);fjtx.setBounds(160,110,100,20);intx.setBounds(160,140,100,20);numcho.setBounds(160,170,100,20);add.setBounds(60,220,50,20);exit.setBounds(300,220,50,20);add(add);add(exit);add(num);add(jb);add(fj);add(in);add(numtx);add(jbtx);add(fjtx);add(intx);add(numcho);//lbadd.addActionListener(this);exit.addActionListener(this);numcho.addItemListener(this);initnumcho();setVisible(true);addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){dispose();}});}publicvoiditemStateChanged(ItemEventi){numtx.setText(numcho.getSelectedItem());}publicvoidinitnumcho(){conx=newcondb();sql="select*from扣除工资";numcho.removeAll();try{rs=conx.getrs(conx.con,sql);while(rs.next()){numcho.add(rs.getString("职工号"));}conx.dbclose(conx.con,rs);conx=null;rs=null;}catch(Exceptioneo){}}publicvoidactionPerformed(ActionEvente){conx=newcondb();if(e.getActionCommand().equals("退出"))this.dispose();if(e.getActionCommand().equals("增加")){sql="select*from扣除工资where职工号='"+numtx.getText()+"'";try{rs=conx.getrs(conx.con,sql);if(rs.next()){sql="insertinto扣除工资(职工号,税收,医疗保险,养老保险)"+"values('"+numtx.getText().trim()+"',"+jbtx.getText()+","+fjtx.getText()+",'"+intx.getText()+"')";try{System.out.println(sql);conx.dbclose(conx.con,null);}catch(Exceptionue){System.out.println(""+ue);} JOptionPanejop=newJOptionPane();jop.showMessageDialog(null,"扣除工资添加成功!","添加成功",-1);conx.dbclose(conx.con,rs);numtx.setText("");jbtx.setText("");fjtx.setText("");conx=null;rs=null;}else{JOptionPanejop=newJOptionPane();jop.showConfirmDialog(null,"添加失败!","警告!",-1);conx.dbclose(conx.con,rs);conx=null;rs=null;}}catch(SQLExceptionet){System.out.println(""+et);}}}}/*else*/bmcx.javaimportjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjavax.swing.*;importjava.awt.Window;classbmcxextendsFrameimplementsActionListener{privatecondbconc=null;privateResultSetrs=null;privateStringsql=null;privateLabelchao=newLabel("职工号:");privateLabelcname=newLabel("姓名:");privateLabelcsex=newLabel("税收:");privateLabelcage=newLabel("医疗保险:");privateLabelcdep=newLabel("退休保险:");privateTextFieldchaotx=newTextField();privateLabelcnametx=newLabel("");privateLabelcsextx=newLabel("");privateLabelcagetx=newLabel("");privateLabelcdeptx=newLabel("");privateButtoncx=newButton("查询");privateButtontc=newButton("退出");publicbmcx(){setTitle("扣除工资查询");setSize(400,250);setBackground(Color.LIGHT_GRAY);this.setLocationRelativeTo(this.getParent());this.setResizable(false);setLayout(null);chao.setBounds(80,50,50,20);cname.setBounds(80,80,50,20);csex.setBounds(80,110,50,20);cage.setBounds(80,140,50,20);cdep.setBounds(80,170,50,20);chaotx.setBounds(160,50,150,20);cnametx.setBounds(160,80,150,20);csextx.setBounds(160,110,150,20);cagetx.setBounds(160,140,150,20);cdeptx.setBounds(140,170,150,20);cx.setBounds(60,205,50,20);tc.setBounds(300,205,50,20);add(chao);add(cname);add(cagetx);add(cage);add(csex);add(cdep);add(chaotx);add(cnametx);add(csextx);add(cdeptx);add(cx);add(tc);setVisible(true);cx.addActionListener(this);tc.addActionListener(this);addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){dispose();}});}publicvoidactionPerformed(ActionEvente){if(e.getActionCommand().equals("退出"))this.dispose();if(e.getActionCommand().equals("查询")){conc=newcondb();sql="select姓名,税收,医疗保险,退休保险from扣除工资,职工where扣除工资.职工号=职工.职工号and扣除工资.职工号='"+chaotx.getText()+"'";try{rs=conc.getrs(conc.con,sql); if(rs.next()) {cnametx.setText(rs.getString("姓名"));csextx.setText(rs.getString("税收"));cagetx.setText(rs.getString("医疗保险"));cdeptx.setText(rs.getString("退休保险"));conc.dbclose(conc.con,rs);conc=null;rs=null;}else{JOptionPanejop=newJOptionPane();jop.showConfirmDialog(null,"该用户不存在!","警告",-1);}}catch(Exceptionee){}}}}condb.javaimportjava.sql.*;publicclasscondb{publicConnectioncon;//在类头定义连接对象publiccondb()//在此构造方法中实现有关程序的加载,同时捕捉异常。{try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}//加载驱动程序catch(java.lang.ClassNotFoundExceptione){System.out.println("error");};try{con=DriverManager.getConnection("jdbc:odbc:xin");}//连接数据源catch(SQLExceptione){System.out.println("connectdatabaseerror!");}}publicResultSetgetrs(Connectioncon,Stringsql)//自定义查询数据库返回记录集的方法。{ResultSetrs=null;try{Statementstmt=con.createStatement();//创建发送sql语句的对象stmt.rs=stmt.executeQuery(sql);//执行查询语句sql,得记录集。}catch(Exceptione){System.out.println(""+e);}returnrs;}//getrs()中行参sql为实现数据库查询的查询语句,con表示数据库连接对象。publicvoidmoddb(Connectioncon,Stringsql)//自定义具有对数据库实现增加,删除,修改功能的方法:{try{Statementstmt=con.createStatement();//创建发送sql语句的对象stmt.stmt.executeUpdate(sql);//实现增加,删除,修改数据库等操作。}catch(Exceptione){}}//方法.executeUpdate()根据sql语句实现对数据库的增加,删除,修改功能。publicvoiddbclose(Connectioncon,ResultSetrs)//定义关闭连接对象和记录集的方法{try{con.close();//关闭连接对象rs.close();}//关闭记录集catch(SQLExceptionrse){}}}dl.javaimportjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjavax.swing.*;importjava.awt.geom.*;classdengluextendsFrame{publicLabelname=newLabel("用户名");publicLabelpass=newLabel("密码");publicTextFieldtxtname=newTextField();publicTextFieldtxtpass=newTextField();publicButtonbtok=newButton("登陆");publicButtonbtexit=newButton("取消");publiccondbconu=newcondb();privateStringsql=null;privateResultSetrs=null;privateImageimg;publicdenglu(){ img=getToolkit().getImage(getClass().getResource("/ww.jpg")); setTitle("欢迎使用工资管理系统");setLayout(null);setResizable(false);setSize(500,350);Dimensionscr=Toolkit.getDefaultToolkit().getScreenSize();Dimensionfrm=this.getSize();setLocation((scr.width-frm.width)/2,(scr.height-frm.height)/2-18);txtpass.setEchoChar('*');txtname.setBounds(120,260,120,27);txtpass.setBounds(120,300,120,27);btok.setBounds(340,260,100,28);btexit.setBounds(340,300,100,28);add(name);add(txtname);add(pass);add(txtpass);add(btok);add(btexit);setVisible(true);btexit.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){dispose();System.exit(0);}});btok.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEvente){sql="select*from数据库用户where用户名='"+txtname.getText()+"'and密码='"+txtpass.getText()+"'";try{rs=conu.getrs(conu.con,sql); if(rs.next()){mainffmf=newmainff();dispose();mf.show();}else{JOptionPanejop=newJOptionPane();jop.showMessageDialog(null,"用户名或密码错误","信息提示!",-1);}}catch(Exceptionee){}}}); addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){dispose();System.exit(0);}}); } publicvoidpaint(Graphicsg){g.setClip(newRectangle2D.Float(0,0,500,350));g.drawImage(img,0,0,this);} }publicclassdl{publicstaticvoidmain(Stringargs[]){dengludeng=newdenglu();}jz.javaimportjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjavax.swing.*;classgzextendsFrameimplementsActionListener,ItemListener{privatecondbconx=null;privateResultSetrs=null;privateStringsql=null;privateLabelnum=newLabel("职工号");privateLabeljb=newLabel("普通请假");privateLabelfj=newLabel("病假");privateLabelin=newLabel("迟到");privateTextFieldnumtx=newTextField();privateTextFieldjbtx=newTextField();privateTextFieldfjtx=newTextField();privateTextFieldintx=newTextField();privateButtonadd=newButton("增加");privateButtonexit=newButton("退出");publicgz(){setTitle("职工休假");setSize(400,300);setBackground(Color.LIGHT_GRAY);this.setLocationRelativeTo(this.getParent());this.setResizable(false);setLayout(null);num.setBounds(80,50,50,20);jb.setBounds(80,80,50,20);fj.setBounds(80,110,50,20);in.setBounds(80,140,50,20);numtx.setBounds(160,50,100,20);jbtx.setBounds(160,80,100,20);fjtx.setBounds(160,110,100,20);intx.setBounds(160,140,100,20);add.setBounds(60,220,50,20);exit.setBounds(300,220,50,20);add(add);add(exit);add(num);add(jb);add(fj);add(in);add(numtx);add(jbtx);add(fjtx);add(intx);//lbadd.addActionListener(this);exit.addActionListener(this);setVisible(true);addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){dispose();}});}publicvoiditemStateChanged(ItemEventi){}publicvoidactionPerformed(ActionEvente){conx=newcondb();if(e.getActionCommand().equals("退出"))this.dispose();if(e.getActionCommand().equals("增加")){sql="select*from职工where职工号='"+numtx.getText()+"'";try{rs=conx.getrs(conx.con,sql);if(rs.next()){sql="insertinto职工(职工号,普通请假,病假,迟到)"+"values('"+numtx.getText().trim()+"',"+jbtx.getText()+","+fjtx.getText()+",'"+intx.getText()+"')";try{System.out.println(sql);conx.dbclose(conx.con,null);}catch(Exceptionue){System.out.println(""+ue);} JOptionPanejop=newJOptionPane();jop.showMessageDialog(null,"职工休假添加成功!","添加成功",-1);conx.dbclose(conx.con,rs);numtx.setText("");jbtx.setText("");fjtx.setText("");conx=null;rs=null;} else{JOptionPanejop=newJOptionPane();jop.showConfirmDialog(null,"添加失败!","警告!",-1);conx.dbclose(conx.con,rs);conx=null;rs=null;}}catch(SQLExceptionet){System.out.println(""+et);}}}}/**/gzcx.javaimportjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjavax.swing.*;importjava.awt.Window;classgzcxextendsFrameimplementsActionListener{privatecondbconc=null;privateResultSetrs=null;privateStringsql=null;privateLabelchao=newLabel("职工号:");privateLabelcjb=newLabel("基本工资:");privateLabelcfj=newLabel("奖金:");privateLabelcsf=newLabel("扣除工资:");privateLabelin=newLabel("实发工资");privateTextFieldchaotx=newTextField();privateLabelcjbtx=newLabel("");privateLabelcfjtx=newLabel("");privateLabelcsftx=newLabel("");privateLabelintx=newLabel("");privateButtoncx=newButton("查询");privateButtontc=newButton("退出");publicgzcx(){setTitle("职工工资查询");setSize(400,250);setBackground(Color.LIGHT_GRAY);this.setLocationRelativeTo(this.getParent());this.setResizable(false);setLayout(null);chao.setBounds(80,50,50,20);cjb.setBounds(80,80,50,20);cfj.setBounds(80,110,50,20);csf.setBounds(80,140,50,20);in.setBounds(80,170,50,20);intx.setBounds(160,170,150,20);chaotx.setBounds(160,50,150,20);cjbtx.setBounds(160,80,150,20);cfjtx.setBounds(160,110,150,20);csftx.setBounds(160,140,150,20);cx.setBounds(60,205,50,20);tc.setBounds(300,205,50,20);add(chao);add(cjb);add(in);add(cfj);add(csf);add(intx);add(cjbtx);add(cfjtx);add(chaotx);add(csftx);add(cx);add(tc);setVisible(true);cx.addActionListener(this);tc.addActionListener(this);addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){dispose();}});}publicvoidactionPerformed(ActionEvente){if(e.getActionCommand().equals("退出"))this.dispose();if(e.getActionCommand().equals("查询")){conc=newcondb();sql="select*from工资where职工号='"+chaotx.getText()+"'";try{rs=conc.getrs(conc.con,sql); if(rs.next()) {cjbtx.setText(rs.getString("基本工资"));cfjtx.setText(rs.getString("奖金"));csftx.setText(rs.getString("扣除工资"));intx.setText(rs.getString("实发工资"));conc.dbclose(conc.con,rs);conc=null;rs=null;}else{JOptionPanejop=newJOptionPane();jop.showConfirmDialog(null,"该用户不存在!","警告",-1);}}catch(Exceptionee){}}}}jiesh.javaimportjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjava.sql.*;classjieshextendsJFrameimplementsActionListener{privatecondbcon=null;privateResultSetrs=null;privateStringsql=null;privateJLabelq1=newJLabel("本软件介绍");privateJTextAreajstx=newJTextArea();privateJButtond2=newJButton("返回主界面");publicjiesh(){super("软件介绍");setSize(400,350);setBackground(Color.LIGHT_GRAY);this.setLocationRelativeTo(this.getParent());setResizable(false);Containercont=this.getContentPane();cont.setLayout(null);q1.setBounds(150,20,300,30);jstx.setBounds(40,50,300,200);jstx.setText("本软件适用于人事工资管理不复杂的中小企业或其他类型\n企事业单位。软件界面友好、操作简单。");jstx.setEditable(false);d2.setBounds(240,260,100,30);cont.add(q1);cont.add(jstx);cont.add(d2);d2.addActionListener(this);setVisible(true);}publicvoidactionPerformed(ActionEventae){if(ae.getActionCommand().equals("返回主界面"))dispose();}}mainff.javaimportjava.awt.*;importjava.awt.event.*;importjava.awt.Window;importjavax.swing.*;importjavax.swing.tree.*;importjava.sql.*;importjava.awt.geom.*;classmainffextendsFrameimplementsActionListener{privatecondbcon=null;privateResultSetrs=null;Stringsql=null;Stringsqlb=null;privateJOptionPanejop=newJOptionPane();privateMenuBarmnubar=newMenuBar();privateMenugongzi=newMenu("工资管理");privateMenulookfor=newMenu("信息查询");privateMenuinitsys=newMenu("系统初始化");privateMenuuser=newMenu("用户管理");privateMenuhelp=newMenu("帮助信息");privateMenuItemgong1=newMenuItem("全部查询");privateMenuItemsearch1=newMenuItem("扣除工资查询");privateMenuItemsearch3=newMenuItem("职工工资查询");privateMenuItemsearch2=newMenuItem("职工休假查询");privateMenuItemdep=newMenuItem("添加工资");privateMenuItememp=newMenuItem("选择支付方式");privateMenuItemselary=newMenuItem("添加休假");privateMenuItemuser1=newMenuItem("用户管理");privateMenuItemhelp1=newMenuItem("系统介绍");privateMenuItemhelp2=newMenuItem("操作说明");privateMenuItemhelp3=newMenuItem("版本信息");privateImageimg;publicmainff(){super("欢迎使用工资管理系统!");setSize(800,600);setBackground(Color.LIGHT_GRAY);setLayout(null);//以下三句设置当前框架位置。Dimensionscr=Toolkit.getDefaultToolkit().getScreenSize();Dimensionfrm=this.getSize();setLocation((int)(scr.getWidth()-frm.getWidth())/2,(int)(scr.getHeight()-frm.getHeight())/2-50);//设置水平居中。gongzi.add(gong1);lookfor.add(search1);lookfor.add(search2);lookfor.add(search3);initsys.add(dep);initsys.add(emp);initsys.add(selary);user.add(user1);mnubar.add(gongzi);mnubar.add(lookfor);mnubar.add(initsys);mnubar.add(user);mnubar.add(help);help.add(help1);help.add(help2);help.add(help3);img=getToolkit().getImage(getClass().getResource("/sk.jpg"));this.setMenuBar(mnubar);//设置菜单条,显示菜单gongzi.addActionListener(this);initsys.addActionListener(this);lookfor.addActionListener(this);user.addActionListener(this);help.addActionListener(this);setVisible(true);//设置可显性addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){tuichtc=newtuich();}});//关闭窗口}publicvoidpaint(Graphicsg){g.setClip(newRectangle2D.Float(0,30,800,570));g.drawImage(img,0,0,this);}publicvoidactionPerformed(ActionEventae){if(ae.getActionCommand().equals("添加休假")){gzgong=newgz();//类调用}if(ae.getActionCommand().equals("选择支付方式")){zgzhi=newzg();//类调用}if(ae.getActionCommand().equals("添加工资")){bmbu=newbm();}if(ae.getActionCommand().equals("职工工资查询")){gzcxgongcx=newgzcx();}if(ae.getActionCommand().equals("扣除工资查询")){bmcxbucx=newbmcx();}if(ae.getActionCommand().equals("职工休假查询")){zgcxzhi=newzgcx();}if(ae.getActionCommand().equals("用户管理")){useruse=newuser();}if(ae.getActionCommand().equals("全部查询")){wholeuse1=newwhole();}if(ae.getActionCommand().equals("系统介绍")){jieshj=newjiesh();}if(ae.getActionCommand().equals("操作说明")){shuomsh=newshuom();}if(ae.getActionCommand().equals("版本信息")){xinxixx=newxinxi();//类调用}}}shuom.javaimportjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjava.sql.*;classshuomextendsJFrameimplementsActionListener{privatecondbcon=null;privateResultSetrs=null;privateStringsql=null;privateJLabelq1=newJLabel("本软件操作说明");privateJTextAreajstx=newJTextArea();privateJButtond2=newJButton("返回主界面");publicshuom(){super("操作说明");setSize(400,350);setBackground(Color.LIGHT_GRAY);this.setLocationRelativeTo(this.getParent());setResizable(false);Containercont=this.getContentPane();cont.setLayout(null);q1.setBounds(120,20,300,30);jstx.setBounds(40,50,300,200);jstx.setText("具体说明见实验报告");jstx.setEditable(false);d2.setBounds(240,260,100,30);cont.add(q1);cont.add(jstx);cont.add(d2);d2.addActionListener(this);setVisible(true);}publicvoidactionPerformed(ActionEventae){if(ae.getActionCommand().equals("返回主界面"))dispose();}}tuich.javaimportjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjava.sql.*;classtuichextendsJFrameimplementsActionListener{privatecondbcon=null;privateResultSetrs=null;privateStringsql=null;privateJLabelq1=newJLabel("是否确定退出本软件?");privateJButtond1=newJButton("确认");privateJButtond2=newJButton("返回");publictuich(){super("结束");setSize(300,180);setBackground(Color.LIGHT_GRAY);this.setLocationRelativeTo(this.getParent());setResizable(false);Containercont=this.getContentPane();cont.setLayout(null);q1.setBounds(80,20,200,30);d1.setBounds(50,80,80,30);d2.setBounds(150,80,80,30);cont.add(q1);cont.add(d1);cont.add(d2);d1.addActionListener(this);d2.addActionListener(this);setVisible(true);}publicvoidactionPerformed(ActionEventte){if(te.getActionCommand().equals("确认")){dispose();System.exit(0);}if(te.getActionCommand().equals("返回"))dispose();}}user.javaimportjava.awt.*;importjava.util.*;importjava.awt.event.*;importjava.awt.Window;importjava.sql.*;importjavax.swing.*;classuserextendsFrameimplementsActionListener,ItemListener{privatecondbcon=null;privateResultSetrs=null;privateStringsql=null;privateButtonbtnadd=newButton("增加");privateButtonbtndel=newButton("删除");privateButtonbtnmod=newButton("修改");privateButtonbtnexit=newButton("退出");privateLabellbname=newLabel("用户");privateLabellbpwd=newLabel("密码");privateLabellbuserchoice=newLabel("用户列表");privateTextFieldtxtname=newTextField();privateTextFieldtxtpwd=newTextField();privateChoiceuserchoice=newChoice();publicuser(){super("系统用户管理");setSize(410,250);this.setLocationRelativeTo(this.getParent());setResizable(false);setBackground(Color.LIGHT_GRAY);setLayout(null);lbname.setSize(50,20);lbpwd.setSize(50,20);lbuserchoice.setSize(50,20);txtname.setSize(170,20);txtpwd.setSize(170,20);userchoice.setSize(170,20);btnadd.setSize(50,20);btndel.setSize(50,20);btnmod.setSize(50,20);btnexit.setSize(50,20);lbname.setLocation(80,50);txtname.setLocation(160,50);lbpwd.setLocation(80,100);txtpwd.setLocation(160,100);userchoice.setLocation(160,150);btnadd.setLocation(60,200);btndel.setLocation(140,200);btnmod.setLocation(220,200);btnexit.setLocation(300,200);add(lbname);add(txtname);add(lbpwd);add(txtpwd);add(lbuserchoice);add(userchoice);add(btnadd);add(btndel);add(btnmod);add(btnexit);btnadd.addActionListener(this);btndel.addActionListener(this);btnmod.addActionListener(this);btnexit.addActionListener(this);setVisible(true);initchoice();userchoice.addItemListener(this);addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){dispose();}});}publicvoidinitchoice(){try{con=newcondb();sql="select用户名from数据库用户";rs=con.getrs(con.con,sql);while(rs.next()){userchoice.addItem(rs.getString("用户名"));}con.dbclose(con.con,rs);con=null;}catch(Exceptione){}}publicvoidactionPerformed(ActionEventee){if(ee.getActionCommand().equals("退出"))dispose();if(ee.getActionCommand().equals("增加")){sql="select*from数据库用户where用户名='"+txtname.getText()+"'";con=newcondb();try{rs=con.getrs(con.con,sql);if(rs.next()){JOptionPanejop=newJOptionPane();jop.showConfirmDialog(null,"该用户已经存在!","警告",-1);con.dbclose(con.con,rs);con=null;rs=null;}else{sql="insertinto数据库用户values('"+txtname.getText()+"','"+txtpwd.getText()+"')";con=newcondb();try{con.moddb(con.con,sql);con.con.close();}catch(SQLExceptionse){}userchoice.addItem(txtname.getText());txtname.setText("");txtpwd.setText("");con=null;}}catch(Exceptiona){}}if(ee.getActionCommand().equals("修改")){sql="update数据库用户set密码='"+txtpwd.getText()+"'where用户名='"+txtname.getText()+"'";con=newcondb();try{con.moddb(con.con,sql);con.con.close();}catch(SQLExceptionse){}txtname.setText("");txtpwd.setText("");con=null;}if(ee.getActionCommand().equals("删除")){JOptionPanejopask=newJOptionPane();if(jopask.showConfirmDialog(null,"你要删除?","请确认",2)==0){con=newcondb();sql="deletefrom数据库用户where用户名='"+txtname.getText()+"'";try{con.moddb(con.con,sql);con.con.close();}catch(SQLExceptionse){}con=null;userchoice.remove(userchoice.getSelectedIndex());txtname.setText("");txtpwd.setText("");}}}publicvoiditemStateChanged(ItemEventie){txtname.setText(userchoice.getSelectedItem());}}whole.javaimportjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjava.sql.*;classwholeextendsJDialogimplementsActionListener{privatecondbcon=null;privateResultSetrs=null;privateStringsql=null;privateJLabelbmhao=newJLabel("职工号:");privateJLabelbmname=newJLabel("姓名:");privateJTextFieldwholetx1=newJTextField();privateJTextFieldwholetx2=newJTextField();pr
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 《社会心理因素》课件
- 《电信业风云》课件
- 寒假自习课 25春初中道德与法治八年级下册教学课件 第二单元 第2课时 公民基本义务
- 《沙盘规则介绍》课件
- 《定价的基本策略》课件
- 班干部工作总结3篇
- 2023年学校志愿者心得体会字万能-学校志愿者工作总结(5篇)
- 2023-2024年项目部安全培训考试题附答案(典型题)
- 毕业销售实习报告模板汇编八篇
- 2023年项目部安全管理人员安全培训考试题及参考答案(模拟题)
- 推板式造波机的机械结构设计
- SAPHR快速指南
- 广东海洋大学大数据库课程设计
- 商业发票INVOICE模板
- (完整版)食堂管理制度及流程
- 某医院后备人才梯队建设方案
- 二年级上册英语教案Unit6 Lesson22︱北京课改版
- 桂枝加龙骨牡蛎汤_金匮要略卷上_方剂加减变化汇总
- 电机与电气控制技术PPT课件
- 废弃钻井泥浆和压裂返排液无害化处理研究报告
- 论文-基于单片机的抢答器.doc
评论
0/150
提交评论