java 职工信息管理系统源代码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

源代码packagelesson2;importjava.sql.*;publicclassemployee{publicStringnum;publicStringname;publicStringsex;publicStringage;publicStringedu;publicStringsla;publicStringadd;publicStringtel;publicvoidinit(Stringx1,Stringx2,Stringx3,Stringx4,Stringx5,Stringx6,Stringx7,Stringx8){num=x1;name=x2;sex=x3;age=x4;edu=x5;sla=x6;add=x7;tel=x8;}publicvoidload(Stringf){try{Class.forName(com.microsoft.sqlserver.jdbc.SQLServerDriver);Stringurl=jdbc:sqlserver://localhost:1433;DatabaseName=employee;StringuserName=sa;Stringpassword=xhw;Connectionconn=DriverManager.getConnection(url,userName,password);if(conn!=null)System.out.println(已成功地与SQLServer2005数据库建立连接!);Statementstmt=conn.createStatement();stmt.executeUpdate(f);stmt.close();}catch(Exceptione){e.printStackTrace();}}}packagelesson2;importjava.awt.*;importjava.awt.event.*;importjava.sql.*;publicclasslesson2_1{staticFramef;CardLayoutmyCard;Panelp1;Panelp2;Panelp3;Panelp4;Panelp5;Panelp6;Panelp7;Panelp8;publicstaticvoidmain(String[]args){lesson2_1test=newlesson2_1();test.go1();test.go2();test.go3();test.go4();test.go5();test.go6();test.go7();test.go8();}publicvoidgo1(){f=newFrame(呵呵!!!);myCard=newCardLayout();f.setLayout(myCard);p1=newPanel();Buttonb1,b2,b3;LabelL1;TextFieldte1;finalTextFieldte2;p1.setLayout(newGridBagLayout());GridBagConstraintsc=newGridBagConstraints();Panelp1_1=newPanel();p1_1.setLayout(newGridBagLayout());GridBagConstraintsx=newGridBagConstraints();b1=newButton(请输入用户名);b1.setBackground(Color.CYAN);x.insets=newInsets(50,50,50,50);x.gridx=0;x.gridy=0;x.gridwidth=1;x.gridheight=1;p1_1.add(b1,x);b2=newButton(请输入密码);b2.setBackground(Color.CYAN);x.gridx=0;x.gridy=5;x.gridwidth=1;x.gridheight=1;p1_1.add(b2,x);te1=newTextField(15);c.insets=newInsets(40,0,40,0);x.gridx=5;x.gridy=0;x.gridwidth=1;x.gridheight=1;p1_1.add(te1,x);te2=newTextField(15);x.gridx=5;x.gridy=5;x.gridwidth=1;x.gridheight=1;p1_1.add(te2,x);L1=newLabel(**********欢迎进入职工管理系统**************);L1.setBackground(Color.CYAN);c.gridx=0;c.gridy=0;c.gridwidth=0;c.gridheight=1;p1.add(L1,c);b3=newButton(登录);b3.setBackground(Color.CYAN);c.gridx=0;c.gridy=10;c.gridwidth=5;c.gridheight=5;p1.add(b3,c);c.gridx=0;c.gridy=20;c.gridwidth=5;c.gridheight=5;p1.add(p1_1,c);p1.setBackground(Color.green);f.add(p1,First);myCard.show(f,First);f.setSize(600,600);f.setVisible(true);f.addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEvente){System.exit(0);}});b3.addMouseListener(newMouseAdapter(){publicvoidmouseClicked(MouseEvente){Stringx=te2.getText();inty=Integer.parseInt(x);if(y==106)myCard.show(f,Second);}});}publicvoidgo2(){p2=newPanel();Buttonb1,b2,b3,b4,b5,b6;LabelL1;p2.setLayout(newGridBagLayout());GridBagConstraintsc=newGridBagConstraints();c.insets=newInsets(50,0,8,0);b1=newButton(1职工信息录入);b1.setBackground(Color.CYAN);c.gridx=1;c.gridy=50;c.gridwidth=5;c.gridheight=50;p2.add(b1,c);b2=newButton(2职工信息浏览);b2.setBackground(Color.CYAN);c.gridx=1;c.gridy=100;c.gridwidth=5;c.gridheight=50;p2.add(b2,c);b3=newButton(3职工信息查询);b3.setBackground(Color.CYAN);c.gridx=1;c.gridy=150;c.gridwidth=5;c.gridheight=50;p2.add(b3,c);b4=newButton(4职工信息排序);b4.setBackground(Color.CYAN);c.gridx=1;c.gridy=200;c.gridwidth=5;c.gridheight=50;p2.add(b4,c);b5=newButton(5职工信息修改);b5.setBackground(Color.CYAN);c.gridx=1;c.gridy=250;c.gridwidth=5;c.gridheight=50;p2.add(b5,c);b6=newButton(6职工信息删除);b6.setBackground(Color.CYAN);c.gridx=1;c.gridy=300;c.gridwidth=5;c.gridheight=50;p2.add(b6,c);L1=newLabel(********欢迎进入职工管理系统**********);L1.setBackground(Color.CYAN);c.gridx=1;c.gridy=0;c.gridwidth=5;c.gridheight=10;p2.add(L1,c);p2.setBackground(Color.green);f.add(p2,Second);b1.addMouseListener(newMouseAdapter(){publicvoidmouseClicked(MouseEvente){myCard.show(f,Third);}});b2.addMouseListener(newMouseAdapter(){publicvoidmouseClicked(MouseEvente){myCard.show(f,Fourth);}});b3.addMouseListener(newMouseAdapter(){publicvoidmouseClicked(MouseEvente){myCard.show(f,Fifth);}});b4.addMouseListener(newMouseAdapter(){publicvoidmouseClicked(MouseEvente){myCard.show(f,Sixth);}});b5.addMouseListener(newMouseAdapter(){publicvoidmouseClicked(MouseEvente){myCard.show(f,Seventh);}});b6.addMouseListener(newMouseAdapter(){publicvoidmouseClicked(MouseEvente){myCard.show(f,Eighth);}});}publicvoidgo3(){p3=newPanel();p3.setLayout(newGridBagLayout());GridBagConstraintsc=newGridBagConstraints();Buttonb1,b2,b3,b4,b5,b6,b7,b8,b9,b10;finalTextFieldte1,te2,te3,te4,te5,te6,te7,te8;LabelL1;c.insets=newInsets(60,50,0,0);L1=newLabel(***************请输入下面信息****************);L1.setBackground(Color.CYAN);c.gridx=0;c.gridy=0;c.gridwidth=0;c.gridheight=1;p3.add(L1,c);b1=newButton(工号);b1.setBackground(Color.CYAN);c.gridx=0;c.gridy=10;c.gridwidth=1;c.gridheight=1;p3.add(b1,c);b2=newButton(姓名);b2.setBackground(Color.CYAN);c.gridx=35;c.gridy=10;c.gridwidth=1;c.gridheight=1;p3.add(b2,c);b3=newButton(性别);b3.setBackground(Color.CYAN);c.gridx=0;c.gridy=30;c.gridwidth=1;c.gridheight=1;p3.add(b3,c);b4=newButton(年龄);b4.setBackground(Color.CYAN);c.gridx=35;c.gridy=30;c.gridwidth=1;c.gridheight=1;p3.add

1 / 31
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功