- 18.53 KB
- 2022-05-17 13:47:37 发布
- 1、本文档共5页,可阅读全部内容。
- 2、本文档内容版权归属内容提供方,所产生的收益全部归内容提供方所有。如果您对本文有版权争议,可选择认领,认领后既往收益都归您。
- 3、本文档由用户上传,本站不保证质量和数量令人满意,可能有诸多瑕疵,付费之前,请仔细先通过免费阅读内容等途径辨别内容交易风险。如存在严重挂羊头卖狗肉之情形,可联系本站下载客服投诉处理。
- 文档侵权举报电话:19940600175。
packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classAttendFrameextendsJFrame//工作制类型{publicAttendFrame(){this.setTitle("工作制类型");this.setVisible(true);this.setContentPane(newJPanel());this.setSize(300,200);create();}privatevoidcreate(){JButtonb1,b2,b3;Boxbox1,box2,box;b1=newJButton("非弹性工作制");b2=newJButton("弹性工作制");b3=newJButton("返回");box1=Box.createHorizontalBox();box2=Box.createHorizontalBox();box=Box.createVerticalBox();box1.add(b1);box1.add(Box.createHorizontalStrut(20));box1.add(b2);box2.add(b3);box.add(box1);box.add(Box.createVerticalStrut(30));box.add(box2);this.add(box);b1.addActionListener(newActionListener()//{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根
UBoundFrameframe=newUBoundFrame();dispose();}});b2.addActionListener(newActionListener()//{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根BoundFrameframe=newBoundFrame();dispose();}});b3.addActionListener(newActionListener()//{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根MFrameframe=newMFrame();dispose();}});}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classBoundFrameextendsJFrame{publicBoundFrame(){this.setTitle("弹性工作制");this.setVisible(true);this.setContentPane(newJPanel());this.setSize(400,400);
create();}JLabelk1,k2,k3,k4,k5,k6;JTextFieldf1,f2,f3,f4,f5,f6;Boxbox1,box2,box3,box4,box5,box;JButtonb1;privatevoidcreate(){k1=newJLabel("工号:");k2=newJLabel("姓名:");k3=newJLabel("当月工时:");k4=newJLabel(":");k5=newJLabel("当月工作天数");k6=newJLabel("当月富余:");b1=newJButton("返回");f1=newJTextField(5);f2=newJTextField(5);f3=newJTextField(5);f4=newJTextField(5);f5=newJTextField(5);f6=newJTextField(5);box1=Box.createHorizontalBox();box2=Box.createHorizontalBox();box3=Box.createHorizontalBox();box4=Box.createHorizontalBox();box5=Box.createHorizontalBox();box=Box.createVerticalBox();box1.add(k1);box1.add(f1);box1.add(Box.createHorizontalStrut(20));box1.add(k2);box1.add(f2);box2.add(k3);box2.add(f3);box2.add(k4);box2.add(f4);box3.add(k5);box3.add(f5);box4.add(k6);box4.add(f6);box5.add(b1);box.add(box1);box.add(Box.createVerticalStrut(20));box.add(box2);
box.add(Box.createVerticalStrut(20));box.add(box3);box.add(Box.createVerticalStrut(20));box.add(box4);box.add(Box.createVerticalStrut(20));box.add(box5);this.add(box);b1.addActionListener(newActionListener()//确定{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根AttendFrameframe=newAttendFrame();dispose();}});}}packagekaoqin;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;publicclassConnectionDB{privateStringJDriver="sun.jdbc.odbc.JdbcOdbcDriver";privateStringsqlURL="jdbc:odbc:bobo";//privateStringJDriver="com.microsoft.sqlserver.jdbc.SQLServerDriver";//privateStringsqlURL="jdbc:sqlserver://localhost:1433;DatabaseName=MyTest;integratedSecurity=TRUE;";privateConnectionconnection;privateStatementstatement;privatestaticConnectionconn=null;privateString[]tableSQL=newString[4];publicConnectionDB(){try{Class.forName(JDriver);connection=DriverManager.getConnection(sqlURL);statement=connection.createStatement();}catch(ClassNotFoundExceptione){e.printStackTrace();}catch(SQLExceptione){e.printStackTrace();
}}publicConnectiongetConnection(){returnconnection;}publicStatementgetStatement(){returnstatement;}publicvoidbreakDB(){try{statement.close();connection.close();}catch(SQLExceptione){e.printStackTrace();}}publicvoidcreateTable(){tableSQL[0]="createtablestaff_info("+"Snochar(9)primarykey,"+"Snamechar(10)notnull,"+"Sagesmallint,"+"enter_timechar(10)notnull,"+"positionchar(10)notnull,"+"sexchar(1),"+"passwordchar(6));";tableSQL[1]="createtablepz_info("+"arrive_hourchar(2),"+"arrive_minutechar(2),"+"leave_hourchar(2),"+"leave_minutechar(2),"+"everyday_timechar(2));";tableSQL[2]="createtableeverymonth_statistics("+"Snochar(9)notnull,"+"Snamechar(10)notnull,"+"remain_timechar(4),"+"late_timessmallint,"+"early_leavesmallint,"+"work_daysmallint,"+"primarykey(Sno),"+"foreignkey(Sno)"+"referencesstaff_info(Sno)ondeletecascade);";tableSQL[3]="createtableeveryday_statistics("+"Snochar(9)notnull,"+"Snamechar(10)notnull,"+
"hourchar(2),"+"minutechar(2),"+"actionchar(6),"+"timechar(4),"+"primarykey(Sno),"+"foreignkey(Sno)"+"referencesstaff_info(Sno)ondeletecascade);";try{for(inti=0;i<4;i++)statement.executeUpdate(tableSQL[i]);}catch(SQLExceptione){e.printStackTrace();}}privatestaticResultSetexecuteQuery(Stringsql){try{if(conn==null)newConnectionDB();returnconn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE).executeQuery(sql);}catch(SQLExceptione){e.printStackTrace();returnnull;}finally{}}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;nection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classEqu_FrameextendsJFrame//配置信息{publicEqu_Frame(){this.setTitle("配置信息");this.setSize(400,400);
this.setContentPane(newJPanel());this.setVisible(true);this.create();}JLabelk1,k2,k3,k4,k5,k6,k7,k8,k9,k10;JLabelf1,f2,f3,f4,f5,f6,f7,f8,f9,f10;Boxbox1,box2,box3,box4,box5,box6,box7,box;JButtonb1,b2;privatevoidcreate(){k1=newJLabel("上班时间:");k2=newJLabel(":");k3=newJLabel("下班时间:");k4=newJLabel(":");k5=newJLabel("每月工作总时间:");k6=newJLabel("每月工作天数:");k7=newJLabel("每月工作日期:");k8=newJLabel("~");k9=newJLabel("每月放假日期:");k10=newJLabel("~");b1=newJButton("修改");b2=newJButton("返回");f1=newJLabel("08");f2=newJLabel("30");f3=newJLabel("17");f4=newJLabel("30");f5=newJLabel("200");f6=newJLabel("22");f7=newJLabel("星期一");f8=newJLabel("星期五");f9=newJLabel("星期六");f10=newJLabel("星期日");box1=Box.createHorizontalBox();box2=Box.createHorizontalBox();box3=Box.createHorizontalBox();box4=Box.createHorizontalBox();box5=Box.createHorizontalBox();box6=Box.createHorizontalBox();box7=Box.createHorizontalBox();box=Box.createVerticalBox();box1.add(k1);box1.add(f1);box1.add(k2);box1.add(f2);
box2.add(k3);box2.add(f3);box2.add(k4);box2.add(f4);box3.add(k5);box3.add(f5);box4.add(k6);box4.add(f6);box5.add(k7);box5.add(f7);box5.add(k8);box5.add(f8);box6.add(k9);box6.add(f9);box6.add(k10);box6.add(f10);box7.add(b1);box7.add(Box.createHorizontalStrut(20));box7.add(b2);box.add(box1);box.add(Box.createVerticalStrut(20));box.add(box2);box.add(Box.createVerticalStrut(20));box.add(box3);box.add(Box.createVerticalStrut(20));box.add(box4);box.add(Box.createVerticalStrut(20));box.add(box5);box.add(Box.createVerticalStrut(20));box.add(box6);box.add(Box.createVerticalStrut(20));box.add(box7);this.add(box);b1.addActionListener(newActionListener()//确定{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根EquAltFrameframe=newEquAltFrame();dispose();}});b2.addActionListener(newActionListener()//确定
{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根MFrameframe=newMFrame();dispose();}});}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classEquAltFrameextendsJFrame//修改配置信息{publicEquAltFrame(){this.setTitle("修改配置信息");this.setSize(400,400);this.setContentPane(newJPanel());this.setVisible(true);this.create();}JLabelk1,k2,k3,k4,k5,k6,k7,k8,k9,k10;JTextFieldf1,f2,f3,f4,f5,f6,f7,f8,f9,f10;Boxbox1,box2,box3,box4,box5,box6,box7,box;JButtonb1,b2;privatevoidcreate(){k1=newJLabel("上班时间:");k2=newJLabel(":");k3=newJLabel("下班时间:");k4=newJLabel(":");k5=newJLabel("每月工作总时间:");k6=newJLabel("每月工作天数:");k7=newJLabel("每月工作日期:");
k8=newJLabel("~");k9=newJLabel("每月放假日期:");k10=newJLabel("~");b1=newJButton("保存");b2=newJButton("取消");f1=newJTextField(5);f2=newJTextField(5);f3=newJTextField(5);f4=newJTextField(5);f5=newJTextField(5);f6=newJTextField(5);f7=newJTextField(5);f8=newJTextField(5);f9=newJTextField(5);f10=newJTextField(5);box1=Box.createHorizontalBox();box2=Box.createHorizontalBox();box3=Box.createHorizontalBox();box4=Box.createHorizontalBox();box5=Box.createHorizontalBox();box6=Box.createHorizontalBox();box7=Box.createHorizontalBox();box=Box.createVerticalBox();box1.add(k1);box1.add(f1);box1.add(k2);box1.add(f2);box2.add(k3);box2.add(f3);box2.add(k4);box2.add(f4);box3.add(k5);box3.add(f5);box4.add(k6);box4.add(f6);box5.add(k7);box5.add(f7);box5.add(k8);box5.add(f8);box6.add(k9);box6.add(f9);box6.add(k10);box6.add(f10);box7.add(b1);
box7.add(Box.createHorizontalStrut(20));box7.add(b2);box.add(box1);box.add(Box.createVerticalStrut(20));box.add(box2);box.add(Box.createVerticalStrut(20));box.add(box3);box.add(Box.createVerticalStrut(20));box.add(box4);box.add(Box.createVerticalStrut(20));box.add(box5);box.add(Box.createVerticalStrut(20));box.add(box6);box.add(Box.createVerticalStrut(20));box.add(box7);this.add(box);b1.addActionListener(newActionListener()//确定{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Equ_Framein=newEqu_Frame();EquAltFrameon=newEquAltFrame();in.f1.setText(on.f1.getText());in.f2.setText(on.f2.getText());in.f3.setText(on.f3.getText());in.f4.setText(on.f4.getText());in.f5.setText(on.f5.getText());in.f6.setText(on.f6.getText());in.f7.setText(on.f7.getText());in.f8.setText(on.f8.getText());in.f9.setText(on.f9.getText());in.f10.setText(on.f10.getText());}});b2.addActionListener(newActionListener()//确定{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Equ_Frameframe=newEqu_Frame();dispose();
}});}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classloginextendsJFrame//管理员登陆界面{publiclogin(){this.setTitle("管理员登陆界面");this.setSize(300,300);this.setContentPane(newJPanel());this.setVisible(true);init();}JTextFieldjTextField1;JPasswordFieldjPasswordField1;privatevoidinit(){JLabeljLabel1=newJLabel("管理员登陆");JLabeljLabel2=newJLabel("用户名");JLabeljLabel3=newJLabel("密码");jTextField1=newJTextField(10);jPasswordField1=newJPasswordField(10);JButtonbutton1=newJButton("确定");JButtonbutton2=newJButton("取消");JButtonbutton3=newJButton("修改密码");Boxbox,box1,box2,box3,box4,box5;box1=Box.createHorizontalBox();box1.add(jLabel1);box1.add(Box.createHorizontalStrut(10));box2=Box.createHorizontalBox();box2.add(jLabel2);box2.add(Box.createHorizontalStrut(20));box2.add(jTextField1);
box3=Box.createHorizontalBox();box3.add(jLabel3);box3.add(Box.createHorizontalStrut(20));box3.add(jPasswordField1);box4=Box.createHorizontalBox();box4.add(button1);box4.add(Box.createHorizontalStrut(20));box4.add(button2);box5=Box.createHorizontalBox();box5.add(button3);box=Box.createVerticalBox();box.add(box1);box.add(Box.createVerticalStrut(20));box.add(box2);box.add(Box.createVerticalStrut(20));box.add(box3);box.add(Box.createVerticalStrut(20));box.add(box4);box.add(Box.createVerticalStrut(20));box.add(box5);this.add(box);button1.addActionListener(newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根//loginim=newlogin();Stringname=jTextField1.getText(),password=jPasswordField1.getText();if(name.equals("admin")&&password.equals("123456")){MFramemi=newMFrame();dispose();}else{JOptionPane.showMessageDialog(newJFrame("WARNING"),"用户名或密码错误");}}});button2.addActionListener(newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){
//TODO自动生成的方法存根Main_loginframe=newMain_login();dispose();}});button3.addActionListener(newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根MPwdf1=newMPwd();dispose();}});}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classlogin1extendsJFrame//普通用户登陆界面{publiclogin1(){this.setTitle("普通用户登陆界面");this.setSize(300,300);this.setContentPane(newJPanel());this.setVisible(true);init();}JTextFieldjTextField1;JPasswordFieldjPasswordField1;privatevoidinit(){JLabeljLabel1=newJLabel("员工登陆");JLabeljLabel2=newJLabel("用户名");JLabeljLabel3=newJLabel("密码");jTextField1=newJTextField(10);
jPasswordField1=newJPasswordField(10);JButtonbutton1=newJButton("确定");JButtonbutton2=newJButton("取消");JButtonbutton3=newJButton("修改密码");Boxbox,box1,box2,box3,box4,box5;box1=Box.createHorizontalBox();box1.add(jLabel1);box1.add(Box.createHorizontalStrut(10));box2=Box.createHorizontalBox();box2.add(jLabel2);box2.add(Box.createHorizontalStrut(20));box2.add(jTextField1);box3=Box.createHorizontalBox();box3.add(jLabel3);box3.add(Box.createHorizontalStrut(20));box3.add(jPasswordField1);box4=Box.createHorizontalBox();box4.add(button1);box4.add(Box.createHorizontalStrut(20));box4.add(button2);box5=Box.createHorizontalBox();box5.add(button3);box=Box.createVerticalBox();box.add(box1);box.add(Box.createVerticalStrut(20));box.add(box2);box.add(Box.createVerticalStrut(20));box.add(box3);box.add(Box.createVerticalStrut(20));box.add(box4);box.add(Box.createVerticalStrut(20));box.add(box5);this.add(box);button1.addActionListener(newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Stringname=jTextField1.getText(),password=jPasswordField1.getText();if(name.equals("user")&&password.equals("123456")){WoSerFrame2mi=newWoSerFrame2();dispose();}
else{JOptionPane.showMessageDialog(newJFrame("WARNING"),"用户名或密码错误");}}});button2.addActionListener(newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Main_loginframe=newMain_login();dispose();}});button3.addActionListener(newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根MPwdf1=newMPwd();dispose();}});}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.io.*;importjava.sql.*;publicclassMain_loginextendsJFrameimplementsActionListener{publicMain_login(){super("选择用户类型");this.setSize(300,300);this.setContentPane(newJPanel());create();}privatevoidcreate(){
JButtonb1,b2,b3;Boxbox1,box2,box3,box;b1=newJButton("系统管理员");b2=newJButton("普通用户");b3=newJButton("退出登陆");b1.addActionListener(this);b2.addActionListener(this);b3.addActionListener(this);box1=Box.createHorizontalBox();box2=Box.createHorizontalBox();box3=Box.createHorizontalBox();box1.add(b1);box2.add(b2);box3.add(b3);box=Box.createVerticalBox();box.add(box1);box.add(Box.createVerticalStrut(20));box.add(box2);box.add(Box.createVerticalStrut(40));box.add(box3);this.add(box);}publicvoidactionPerformed(ActionEvente){if(e.getActionCommand()=="系统管理员"){loginframe=newlogin();dispose();}elseif(e.getActionCommand()=="普通用户"){login1frame=newlogin1();dispose();}elseif(e.getActionCommand()=="退出登陆"){System.exit(0);}}publicstaticvoidmain(Stringargs[]){//ConnectionDBmyDB=newConnectionDB();intflag=0;//判断是否创建过数据库的标志Filefile=newFile("SQL.txt");
try{//读入标志FileReaderin=newFileReader(file);intlen;if((len=in.read())!=-1)flag=1;//已创建了数据库,置1in.close();}catch(FileNotFoundExceptione){e.printStackTrace();}catch(IOExceptione){e.printStackTrace();}//没有创建过数据库if(flag==0){ConnectionDBmyDB=newConnectionDB();myDB.createTable();myDB.breakDB();try{//写入标志FileWriterout=newFileWriter(file);out.write("1");out.close();}catch(IOExceptione){e.printStackTrace();}}Main_loginframe1=newMain_login();frame1.setVisible(true);}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classMFrameextendsJFrame//主功能界面{publicMFrame(){
this.setTitle("主要功能");this.setContentPane(newJPanel());this.setSize(350,200);this.setVisible(true);init();}privatevoidinit(){JButtonbutton1=newJButton("员工信息管理");JButtonbutton2=newJButton("员工出勤信息");JButtonbutton3=newJButton("配置信息");JButtonbutton4=newJButton("退出登陆");Boxbox1=Box.createHorizontalBox();Boxbox2=Box.createHorizontalBox();Boxbox3=Box.createVerticalBox();box1.add(button1);box1.add(Box.createHorizontalStrut(10));box1.add(button2);box1.add(Box.createHorizontalStrut(10));box1.add(button3);box2.add(button4);box3.add(box1);box3.add(Box.createVerticalStrut(30));box3.add(box2);this.add(box3);button1.addActionListener(newActionListener()//{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Worker_Frameframe=newWorker_Frame();dispose();}});button2.addActionListener(newActionListener()//{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根AttendFrameframe=newAttendFrame();dispose();}
});button3.addActionListener(newActionListener()//{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Equ_Frameframe=newEqu_Frame();dispose();}});button4.addActionListener(newActionListener()//{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Main_loginframe=newMain_login();dispose();}});}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classMPwdextendsJFrame//管理员密码修改{publicMPwd(){this.setTitle("修改密码");this.setVisible(true);this.setSize(300,200);this.setContentPane(newJPanel());init();}JLabelL1,L2,L3;
JPasswordFieldp1,p2,p3;JButtonb1,b2;Boxbox1,box2,box3,box4,box;privatevoidinit(){L1=newJLabel("请输入原密码:");L2=newJLabel("请输入新密码:");L3=newJLabel("请再次输入密码:");p1=newJPasswordField(10);p2=newJPasswordField(10);p3=newJPasswordField(10);b1=newJButton("确定");b2=newJButton("取消");box1=Box.createHorizontalBox();box1.add(L1);box1.add(Box.createHorizontalStrut(20));box1.add(p1);box2=Box.createHorizontalBox();box2.add(L2);box2.add(Box.createHorizontalStrut(20));box2.add(p2);box3=Box.createHorizontalBox();box3.add(L3);box3.add(Box.createHorizontalStrut(20));box3.add(p3);box4=Box.createHorizontalBox();box4.add(b1);box4.add(Box.createHorizontalStrut(20));box4.add(b2);box=Box.createVerticalBox();box.add(box1);box.add(Box.createVerticalStrut(10));box.add(box2);box.add(Box.createVerticalStrut(10));box.add(box3);box.add(Box.createVerticalStrut(10));box.add(box4);this.add(box1);this.add(box2);this.add(box3);this.add(box4);this.add(box);b1.addActionListener(newActionListener()//确定{
@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法if(p1.getText().equals("123456")){if(p2.getText().equals(p3.getText())){JOptionPane.showMessageDialog(newJFrame("WARNING"),"密码修改成功");loginframe=newlogin();dispose();}else{JOptionPane.showMessageDialog(newJFrame("WARNING"),"两次密码输入不一致,请重新输入");}}else{JOptionPane.showMessageDialog(newJFrame("WARNING"),"原密码输入不正确,请重新输入");}}});b2.addActionListener(newActionListener()//确定{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Main_loginframe=newMain_login();dispose();}});}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;
importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classOperatSFrameextendsJFrame//提示类{privateJLabeldisplayLabel;privatestaticFontfont=newFont("楷体",Font.BOLD,14);publicOperatSFrame(){this.setSize(300,100);this.setLayout(null);this.setResizable(false);this.setVisible(true);this.addCompnents();}privatevoidaddCompnents(){displayLabel=newJLabel("操作成功!");displayLabel.setFont(font);displayLabel.setBounds(80,30,100,30);this.add(displayLabel);}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classUBoundFrameextendsJFrame//非弹性工作制{publicUBoundFrame(){this.setTitle("非弹性工作制");this.setVisible(true);this.setContentPane(newJPanel());this.setSize(400,400);create();}
JLabelk1,k2,k3,k4,k5,k6,k7,k8,k9,k10;JTextFieldf1,f2,f3,f4,f5,f6,f7,f8,f9,f10;Boxbox1,box2,box3,box4,box5,box6,box7,box;JButtonb1;privatevoidcreate(){k1=newJLabel("工号:");k2=newJLabel("姓名:");k3=newJLabel("进入时间:");k4=newJLabel(":");k5=newJLabel("离开时间:");k6=newJLabel(":");k7=newJLabel("工作时间:");k8=newJLabel(":");k9=newJLabel("早退次数:");k10=newJLabel("迟到次数:");b1=newJButton("返回");f1=newJTextField(5);f2=newJTextField(5);f3=newJTextField(5);f4=newJTextField(5);f5=newJTextField(5);f6=newJTextField(5);f7=newJTextField(5);f8=newJTextField(5);f9=newJTextField(5);f10=newJTextField(5);box1=Box.createHorizontalBox();box2=Box.createHorizontalBox();box3=Box.createHorizontalBox();box4=Box.createHorizontalBox();box5=Box.createHorizontalBox();box6=Box.createHorizontalBox();box7=Box.createHorizontalBox();box=Box.createVerticalBox();box1.add(k1);box1.add(f1);box1.add(Box.createHorizontalStrut(20));box1.add(k2);box1.add(f2);box2.add(k3);box2.add(f3);box2.add(k4);box2.add(f4);
box3.add(k5);box3.add(f5);box3.add(k6);box3.add(f6);box4.add(k7);box4.add(f7);box4.add(k8);box4.add(f8);box5.add(k9);box5.add(f9);box6.add(k10);box6.add(f10);box7.add(b1);box.add(box1);box.add(Box.createVerticalStrut(20));box.add(box2);box.add(Box.createVerticalStrut(20));box.add(box3);box.add(Box.createVerticalStrut(20));box.add(box4);box.add(Box.createVerticalStrut(20));box.add(box5);box.add(Box.createVerticalStrut(20));box.add(box6);box.add(Box.createVerticalStrut(20));box.add(box7);this.add(box);b1.addActionListener(newActionListener()//确定{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根AttendFrameframe=newAttendFrame();dispose();}});}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;ction;
importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classWoAddFrameextendsJFrame//添加员工{privateConnectionDBmyCon=newConnectionDB();privateJButtonYesBtn,NoBtn;privatestaticJTextFieldwoName,woNo,woAge,woYear,woPosition,woSex,woPassword;privateJLabelwoNameLabel,woNoLabel,woAgeLabel,woYearLabel,woPositionLabel,woSexLabel,woPasswordLabel;//提示区privatestaticFontfont=newFont("楷体",Font.BOLD,14);publicWoAddFrame(){this.setTitle("添加员工");this.setBounds(200,200,400,300);this.setLayout(null);this.setResizable(false);this.setVisible(true);this.addCompnents();this.add(getwoName());this.add(getwoNo());this.add(getwoAge());this.add(getwoYear());this.add(getwoPosition());this.add(getwoSex());this.add(getwoPassword());}privatevoidaddCompnents(){woNameLabel=newJLabel("员工姓名:");woNameLabel.setFont(font);woNameLabel.setBounds(70,10,70,20);this.add(woNameLabel);woNoLabel=newJLabel("员工编号:");woNoLabel.setFont(font);woNoLabel.setBounds(70,30,70,20);this.add(woNoLabel);woAgeLabel=newJLabel("员工年龄:");woAgeLabel.setFont(font);woAgeLabel.setBounds(70,50,70,20);this.add(woAgeLabel);
woYearLabel=newJLabel("入职时间:");woYearLabel.setFont(font);woYearLabel.setBounds(70,70,70,20);this.add(woYearLabel);woPositionLabel=newJLabel("员工职位:");woPositionLabel.setFont(font);woPositionLabel.setBounds(70,90,70,20);this.add(woPositionLabel);woSexLabel=newJLabel("员工性别:");woSexLabel.setFont(font);woSexLabel.setBounds(70,110,70,20);this.add(woSexLabel);woPasswordLabel=newJLabel("员工密码:");woPasswordLabel.setFont(font);woPasswordLabel.setBounds(70,130,70,20);this.add(woPasswordLabel);YesBtn=newJButton("确定");YesBtn.setFont(font);YesBtn.setBounds(100,180,70,20);this.add(YesBtn);NoBtn=newJButton("取消");NoBtn.setFont(font);NoBtn.setBounds(180,180,70,20);NoBtn.addActionListener(newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Worker_Frameframe=newWorker_Frame();dispose();}});this.add(NoBtn);YesBtn.addActionListener(newActionListener()//添加确认按钮响应{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Stringsql="insertintostaff_info(Sno,Sname,Sage,enter_time,position,sex,password)values(""+woNo.getText()+"",""+woName.getText()+"",""+woAge.getText()+"",""+woYear.getText()+"",""+woPosition.getText()+"",""+woSex.getText()+"",""+woPassword.getText()+"");";
try{myCon.getStatement().executeUpdate(sql);myCon.breakDB();}catch(SQLExceptione1){e1.printStackTrace();}OperatSFrameframe=newOperatSFrame();}});}publicstaticJTextFieldgetwoName(){if(woName==null){woName=newJTextField();woName.setBounds(150,10,150,20);woName.setFont(font);woName.setForeground(Color.blue);}returnwoName;}publicstaticJTextFieldgetwoNo(){if(woNo==null){woNo=newJTextField();woNo.setBounds(150,30,150,20);woNo.setFont(font);woNo.setForeground(Color.blue);}returnwoNo;}publicstaticJTextFieldgetwoAge(){if(woAge==null){woAge=newJTextField();woAge.setBounds(150,50,150,20);woAge.setFont(font);woAge.setForeground(Color.blue);}returnwoAge;}publicstaticJTextFieldgetwoYear(){if(woYear==null){woYear=newJTextField();
woYear.setBounds(150,70,150,20);woYear.setFont(font);woYear.setForeground(Color.blue);}returnwoYear;}publicstaticJTextFieldgetwoPosition(){if(woPosition==null){woPosition=newJTextField();woPosition.setBounds(150,90,150,20);woPosition.setFont(font);woPosition.setForeground(Color.blue);}returnwoPosition;}publicstaticJTextFieldgetwoSex(){if(woSex==null){woSex=newJTextField();woSex.setBounds(150,110,150,20);woSex.setFont(font);woSex.setForeground(Color.blue);}returnwoSex;}publicstaticJTextFieldgetwoPassword(){if(woPassword==null){woPassword=newJTextField();woPassword.setBounds(150,130,150,20);woPassword.setFont(font);woPassword.setForeground(Color.blue);}returnwoPassword;}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.*;classWoAltFrameextendsJFrame//修改员工信息{
privateConnectionDBmyCon=newConnectionDB();privateJButtonYesBtn,NoBtn;privatestaticJTextFieldwoName,woNo1,woNo2,woAge,woYear,woPosition,woSex,woPassword;privateJLabelwoNameLabel,woNoLabel1,woNoLabel2,woAgeLabel,woYearLabel,woPositionLabel,woSexLabel,woPasswordLabel;privatestaticFontfont=newFont("楷体",Font.BOLD,14);publicWoAltFrame(){this.setTitle("修改员工信息");this.setBounds(300,300,400,300);this.setLayout(null);this.setResizable(false);this.setVisible(true);this.addCompnents();this.add(getwoNo1());this.add(getwoNo2());this.add(getwoName());this.add(getwoAge());this.add(getwoYear());this.add(getwoPosition());this.add(getwoSex());this.add(getwoPassword());}privatevoidaddCompnents(){woNoLabel1=newJLabel("原编号:");woNoLabel1.setFont(font);woNoLabel1.setBounds(70,10,70,20);this.add(woNoLabel1);woNoLabel2=newJLabel("修改编号:");woNoLabel2.setFont(font);woNoLabel2.setBounds(70,30,70,20);this.add(woNoLabel2);woNameLabel=newJLabel("修改姓名:");woNameLabel.setFont(font);woNameLabel.setBounds(70,50,70,20);this.add(woNameLabel);woAgeLabel=newJLabel("修改年龄:");woAgeLabel.setFont(font);woAgeLabel.setBounds(70,70,70,20);this.add(woAgeLabel);woYearLabel=newJLabel("修改时间:");
woYearLabel.setFont(font);woYearLabel.setBounds(70,90,70,20);this.add(woYearLabel);woPositionLabel=newJLabel("修改职位:");woPositionLabel.setFont(font);woPositionLabel.setBounds(70,110,70,20);this.add(woPositionLabel);woSexLabel=newJLabel("修改性别:");woSexLabel.setFont(font);woSexLabel.setBounds(70,130,70,20);this.add(woSexLabel);woPasswordLabel=newJLabel("修改密码:");woPasswordLabel.setFont(font);woPasswordLabel.setBounds(70,150,70,20);this.add(woPasswordLabel);YesBtn=newJButton("确定");YesBtn.setFont(font);YesBtn.setBounds(100,210,70,20);this.add(YesBtn);NoBtn=newJButton("取消");NoBtn.setFont(font);NoBtn.setBounds(180,210,70,20);this.add(NoBtn);NoBtn.addActionListener(newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Worker_Frameframe=newWorker_Frame();dispose();}});YesBtn.addActionListener(newActionListener()//添加确认按钮响应{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Stringsql1="updatestaff_infosetSno="+woNo2.getText()+"whereSno="+woNo1.getText();try{myCon.getStatement().executeUpdate(sql1);myCon.breakDB();}catch(SQLExceptione1){
e1.printStackTrace();}OperatSFrameframe=newOperatSFrame();}});}publicstaticJTextFieldgetwoNo1(){if(woNo1==null){woNo1=newJTextField();woNo1.setBounds(150,10,150,20);woNo1.setFont(font);woNo1.setForeground(Color.blue);}returnwoNo1;}publicstaticJTextFieldgetwoNo2()//{if(woNo2==null){woNo2=newJTextField();woNo2.setFont(font);woNo2.setBounds(150,30,150,20);woNo2.setForeground(Color.blue);}returnwoNo2;}publicstaticJTextFieldgetwoName()//{if(woName==null){woName=newJTextField();woName.setFont(font);woName.setBounds(150,50,150,20);woName.setForeground(Color.blue);}returnwoName;}publicstaticJTextFieldgetwoAge(){if(woAge==null){woAge=newJTextField();woAge.setBounds(150,70,150,20);woAge.setFont(font);
woAge.setForeground(Color.blue);}returnwoAge;}publicstaticJTextFieldgetwoYear(){if(woYear==null){woYear=newJTextField();woYear.setBounds(150,90,150,20);woYear.setFont(font);woYear.setForeground(Color.blue);}returnwoYear;}publicstaticJTextFieldgetwoPosition(){if(woPosition==null){woPosition=newJTextField();woPosition.setBounds(150,110,150,20);woPosition.setFont(font);woPosition.setForeground(Color.blue);}returnwoPosition;}publicstaticJTextFieldgetwoSex(){if(woSex==null){woSex=newJTextField();woSex.setBounds(150,130,150,20);woSex.setFont(font);woSex.setForeground(Color.blue);}returnwoSex;}publicstaticJTextFieldgetwoPassword(){if(woPassword==null){woPassword=newJTextField();woPassword.setBounds(150,150,150,20);woPassword.setFont(font);woPassword.setForeground(Color.blue);}returnwoPassword;}
}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.*;classWoDelFrameextendsJFrame{privateConnectionDBmyCon=newConnectionDB();privateJButtonYesBtn,NoBtn;privateJLabelwoNoLabel;privatestaticJTextFieldwoNo;privatestaticFontfont=newFont("楷体",Font.BOLD,14);publicWoDelFrame(){this.setTitle("删除员工");this.setSize(400,400);this.setLayout(null);this.setResizable(false);this.setVisible(true);this.addCompnents();this.add(getwoNo());}privatevoidaddCompnents(){woNoLabel=newJLabel("员工编号:");woNoLabel.setFont(font);woNoLabel.setBounds(100,80,70,20);this.add(woNoLabel);YesBtn=newJButton("确定");YesBtn.setFont(font);YesBtn.setBounds(130,150,80,30);this.add(YesBtn);NoBtn=newJButton("取消");NoBtn.setFont(font);NoBtn.setBounds(220,150,80,30);this.add(NoBtn);NoBtn.addActionListener(newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Worker_Frameframe=newWorker_Frame();dispose();
}});YesBtn.addActionListener(newActionListener()//添加确认按钮响应{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Stringsql="deletefromstaff_infowhereSno="+woNo.getText()+"";try{myCon.getStatement().executeUpdate(sql);myCon.breakDB();}catch(SQLExceptione1){e1.printStackTrace();}OperatSFrameframe=newOperatSFrame();}});}publicstaticJTextFieldgetwoNo(){if(woNo==null){woNo=newJTextField();woNo.setBounds(180,80,150,20);woNo.setFont(font);woNo.setForeground(Color.blue);}returnwoNo;}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.ResultSet;importjava.sql.SQLException;importjava.sql.Statement;importjava.sql.*;classWorker_FrameextendsJFrame//员工信息管理{publicWorker_Frame(){
this.setTitle("员工信息管理");this.setVisible(true);this.setSize(400,400);init();}JButtonbutton1,button2,button3,button4,button5;privatevoidinit(){button1=newJButton("员工信息添加");button2=newJButton("员工信息修改");button3=newJButton("员工信息删除");button4=newJButton("员工信息查询");button5=newJButton("返回");Boxbox1=Box.createHorizontalBox();Boxbox2=Box.createHorizontalBox();Boxbox4=Box.createHorizontalBox();Boxbox3=Box.createVerticalBox();box1.add(button1);box1.add(Box.createHorizontalStrut(20));box1.add(button2);box2.add(button3);box2.add(Box.createHorizontalStrut(20));box2.add(button4);box4.add(button5);box3.add(box1);box3.add(box2);box3.add(Box.createVerticalStrut(30));box3.add(box4);this.add(box3);button1.addActionListener(newActionListener()//添加员工信息{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根WoAddFrameframe=newWoAddFrame();dispose();}});button2.addActionListener(newActionListener()//修改员工信息{@OverridepublicvoidactionPerformed(ActionEvente){
//TODO自动生成的方法存根WoAltFrameframe=newWoAltFrame();dispose();}});button3.addActionListener(newActionListener()//删除员工信息{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根WoDelFrameframe=newWoDelFrame();dispose();}});button4.addActionListener(newActionListener()//查询员工信息{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根WoSerFrameframe=newWoSerFrame();dispose();}});button5.addActionListener(newActionListener()//返回{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根MFrameframe=newMFrame();dispose();}});}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.*;classWoSerFrameextendsJFrame//管理员查询{
privateConnectionDBmyCon=newConnectionDB();privateJButtonYesBtn,NoBtn;privatestaticJTextFieldwoName,woNo,woAge,woYear,woPosition,woSex,woPassword;privateJLabelwoNameLabel,woNoLabel,woAgeLabel,woYearLabel,woPositionLabel,woSexLabel,woPasswordLabel;//提示区privatestaticFontfont=newFont("楷体",Font.BOLD,14);publicWoSerFrame(){this.setTitle("查询员工");this.setSize(400,600);this.setLayout(null);this.setResizable(false);this.setVisible(true);this.addCompnents();this.add(getwoNo());this.add(getwoName());this.add(getwoAge());this.add(getwoYear());this.add(getwoPosition());this.add(getwoSex());this.add(getwoPassword());}privatevoidaddCompnents(){woNameLabel=newJLabel("姓名:");woNameLabel.setFont(font);woNameLabel.setBounds(100,120,60,20);this.add(woNameLabel);woNoLabel=newJLabel("编号:");woNoLabel.setFont(font);woNoLabel.setBounds(100,10,60,20);this.add(woNoLabel);woAgeLabel=newJLabel("年龄:");woAgeLabel.setFont(font);woAgeLabel.setBounds(100,160,70,20);this.add(woAgeLabel);woYearLabel=newJLabel("时间:");woYearLabel.setFont(font);woYearLabel.setBounds(100,200,70,20);this.add(woYearLabel);woPositionLabel=newJLabel("职位:");woPositionLabel.setFont(font);woPositionLabel.setBounds(100,240,70,20);
this.add(woPositionLabel);woSexLabel=newJLabel("性别:");woSexLabel.setFont(font);woSexLabel.setBounds(100,280,70,20);this.add(woSexLabel);woPasswordLabel=newJLabel("密码:");woPasswordLabel.setFont(font);woPasswordLabel.setBounds(100,320,70,20);this.add(woPasswordLabel);YesBtn=newJButton("确定");YesBtn.setFont(font);YesBtn.setBounds(130,50,80,30);this.add(YesBtn);NoBtn=newJButton("取消");NoBtn.setFont(font);NoBtn.setBounds(220,50,80,30);this.add(NoBtn);NoBtn.addActionListener(newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Worker_Frameframe=newWorker_Frame();dispose();}});YesBtn.addActionListener(newActionListener()//添加确认按钮响应{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Connectioncon=myCon.getConnection();try{PreparedStatementps=con.prepareStatement("selectSname,Sage,enter_time,position,sex,passwordfromstaff_infowhereSno=?");Strings=woNo.getText();ps.setString(1,woNo.getText());ResultSetrs=ps.executeQuery();while(rs.next()){Stringname=rs.getString("Sname");Stringage=rs.getString("Sage");
Stringyear=rs.getString("enter_time");Stringposition=rs.getString("position");Stringsex=rs.getString("sex");Stringpassword=rs.getString("password");woName.setText(name);woAge.setText(age);woYear.setText(year);woPosition.setText(position);woSex.setText(sex);woPassword.setText(password);}}catch(SQLExceptionex){ex.printStackTrace();}OperatSFrameframe=newOperatSFrame();}});}publicstaticJTextFieldgetwoNo(){if(woNo==null){woNo=newJTextField();woNo.setBounds(150,10,150,20);woNo.setFont(font);woNo.setForeground(Color.blue);}returnwoNo;}publicstaticJTextFieldgetwoName(){if(woName==null){woName=newJTextField();woName.setBounds(150,120,150,20);woName.setFont(font);woName.setForeground(Color.blue);}returnwoName;}publicstaticJTextFieldgetwoAge(){if(woAge==null){woAge=newJTextField();woAge.setBounds(150,160,150,20);
woAge.setFont(font);woAge.setForeground(Color.blue);}returnwoAge;}publicstaticJTextFieldgetwoYear(){if(woYear==null){woYear=newJTextField();woYear.setBounds(150,200,150,20);woYear.setFont(font);woYear.setForeground(Color.blue);}returnwoYear;}publicstaticJTextFieldgetwoPosition(){if(woPosition==null){woPosition=newJTextField();woPosition.setBounds(150,240,150,20);woPosition.setFont(font);woPosition.setForeground(Color.blue);}returnwoPosition;}publicstaticJTextFieldgetwoSex(){if(woSex==null){woSex=newJTextField();woSex.setBounds(150,280,150,20);woSex.setFont(font);woSex.setForeground(Color.blue);}returnwoSex;}publicstaticJTextFieldgetwoPassword(){if(woPassword==null){woPassword=newJTextField();woPassword.setBounds(150,320,150,20);woPassword.setFont(font);woPassword.setForeground(Color.blue);}returnwoPassword;
}}packagekaoqin;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.*;classWoSerFrame2extendsJFrame//员工查询{privateConnectionDBmyCon=newConnectionDB();privateJButtonYesBtn,NoBtn;privatestaticJTextFieldwoName,woNo,woAge,woYear,woPosition,woSex,woPassword;privateJLabelwoNameLabel,woNoLabel,woAgeLabel,woYearLabel,woPositionLabel,woSexLabel,woPasswordLabel;//提示区privatestaticFontfont=newFont("楷体",Font.BOLD,14);publicWoSerFrame2(){this.setTitle("查询员工");this.setSize(400,600);this.setLayout(null);this.setResizable(false);this.setVisible(true);this.addCompnents();this.add(getwoNo());this.add(getwoName());this.add(getwoAge());this.add(getwoYear());this.add(getwoPosition());this.add(getwoSex());this.add(getwoPassword());}privatevoidaddCompnents(){woNameLabel=newJLabel("姓名:");woNameLabel.setFont(font);woNameLabel.setBounds(100,120,60,20);this.add(woNameLabel);woNoLabel=newJLabel("编号:");woNoLabel.setFont(font);woNoLabel.setBounds(100,10,60,20);this.add(woNoLabel);woAgeLabel=newJLabel("年龄:");woAgeLabel.setFont(font);
woAgeLabel.setBounds(100,160,70,20);this.add(woAgeLabel);woYearLabel=newJLabel("时间:");woYearLabel.setFont(font);woYearLabel.setBounds(100,200,70,20);this.add(woYearLabel);woPositionLabel=newJLabel("职位:");woPositionLabel.setFont(font);woPositionLabel.setBounds(100,240,70,20);this.add(woPositionLabel);woSexLabel=newJLabel("性别:");woSexLabel.setFont(font);woSexLabel.setBounds(100,280,70,20);this.add(woSexLabel);woPasswordLabel=newJLabel("密码:");woPasswordLabel.setFont(font);woPasswordLabel.setBounds(100,320,70,20);this.add(woPasswordLabel);YesBtn=newJButton("确定");YesBtn.setFont(font);YesBtn.setBounds(130,50,80,30);this.add(YesBtn);NoBtn=newJButton("取消");NoBtn.setFont(font);NoBtn.setBounds(220,50,80,30);this.add(NoBtn);NoBtn.addActionListener(newActionListener(){@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根System.exit(0);}});YesBtn.addActionListener(newActionListener()//添加确认按钮响应{@OverridepublicvoidactionPerformed(ActionEvente){//TODO自动生成的方法存根Connectioncon=myCon.getConnection();try{PreparedStatementps=con.prepareStatement("select
Sname,Sage,enter_time,position,sex,passwordfromstaff_infowhereSno=?");Strings=woNo.getText();ps.setString(1,woNo.getText());ResultSetrs=ps.executeQuery();while(rs.next()){Stringname=rs.getString("Sname");Stringage=rs.getString("Sage");Stringyear=rs.getString("enter_time");Stringposition=rs.getString("position");Stringsex=rs.getString("sex");Stringpassword=rs.getString("password");woName.setText(name);woAge.setText(age);woYear.setText(year);woPosition.setText(position);woSex.setText(sex);woPassword.setText(password);}}catch(SQLExceptionex){ex.printStackTrace();}OperatSFrameframe=newOperatSFrame();}});}publicstaticJTextFieldgetwoNo(){if(woNo==null){woNo=newJTextField();woNo.setBounds(150,10,150,20);woNo.setFont(font);woNo.setForeground(Color.blue);}returnwoNo;}publicstaticJTextFieldgetwoName(){if(woName==null){woName=newJTextField();woName.setBounds(150,120,150,20);woName.setFont(font);woName.setForeground(Color.blue);
}returnwoName;}publicstaticJTextFieldgetwoAge(){if(woAge==null){woAge=newJTextField();woAge.setBounds(150,160,150,20);woAge.setFont(font);woAge.setForeground(Color.blue);}returnwoAge;}publicstaticJTextFieldgetwoYear(){if(woYear==null){woYear=newJTextField();woYear.setBounds(150,200,150,20);woYear.setFont(font);woYear.setForeground(Color.blue);}returnwoYear;}publicstaticJTextFieldgetwoPosition(){if(woPosition==null){woPosition=newJTextField();woPosition.setBounds(150,240,150,20);woPosition.setFont(font);woPosition.setForeground(Color.blue);}returnwoPosition;}publicstaticJTextFieldgetwoSex(){if(woSex==null){woSex=newJTextField();woSex.setBounds(150,280,150,20);woSex.setFont(font);woSex.setForeground(Color.blue);}returnwoSex;}publicstaticJTextFieldgetwoPassword()
{if(woPassword==null){woPassword=newJTextField();woPassword.setBounds(150,320,150,20);woPassword.setFont(font);woPassword.setForeground(Color.blue);}returnwoPassword;}}