




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、package rsgl;import java.awt.* ;import java.awt.event.*;import java.sql.*;import java.util.*;import javax.swing.*;import javax.swing.border.*;public class A extends JFrameprotected JPanel p = new JPanel();protected JPanel p1 = new JPanel();protected JPanel p2 = new JPanel();protected JPanel p3= new
2、JPanel();JMenuBar M =new JMenuBar();JMenu m1 = new JMenu(基本信息模塊);JMenu m2 = new JMenu(考勤考評(píng)信息模塊);JMenu m3 = new JMenu(系統(tǒng)維護(hù)信息模塊);JMenuItem mm1 = new JMenuItem(員工基本信息);JMenuItem mm2 = new JMenuItem(員工家庭成員基本信息);JMenuItem mm3 = new JMenuItem(員工培訓(xùn)信息);JMenuItem mm4 = new JMenuItem(員工考勤信息);JMenuItem mm5 = n
3、ew JMenuItem(員工考評(píng)信息);JMenuItem mm6 = new JMenuItem(普通管理員);JMenuItem mm7 = new JMenuItem(高級(jí)管理員);JMenuItem mm8 = new JMenuItem(退出);protected JLabel l1 = new JLabel(員工編號(hào):);protected JLabel l2 = new JLabel(姓 名:);protected JLabel l3 = new JLabel(性 別:);protected JLabel l4 = new JLabel(年 齡:);protected JLab
4、el l5 = new JLabel(部 門:);protected JTextField t1 = new JTextField(10);protected JTextField t2 = new JTextField(10);protected JTextField t3 = new JTextField(10);protected JTextField t4 = new JTextField(10);protected JTextField t5 = new JTextField(10);private JButton b1 = new JButton(查詢);private JButt
5、on b2 = new JButton(插入);private JButton b3 = new JButton(修改);private JButton b4 = new JButton(刪除);private JButton b5 = new JButton(清除);private JButton b6 = new JButton(下一條);private Connection c; / jve:decl-index=0:private Statement s; / jve:decl-index=0:private ResultSet r; / jve:decl-index=0:public
6、 A()super(人事管理系統(tǒng));getContentPane().add(p);setJMenuBar(M);M.add(m1);M.add(m2);M.add(m3);m1.add(mm1);m1.add(mm2);m1.add(mm3);m1.addSeparator();m1.add(mm8);m2.add(mm4);m2.add(mm5);m3.add(mm6);m3.add(mm7);p.add(p1,BorderLayout.NORTH);p.add(p2,BorderLayout.CENTER);p.add(p3,BorderLayout.SOUTH);p1.setLayou
7、t(new GridLayout(5,2,1,3);p1.add(l1);p1.add(t1);p1.add(l2);p1.add(t2);p1.add(l3);p1.add(t3);p1.add(l4);p1.add(t4);p1.add(l5);p1.add(t5);p2.add(b1);p1.add(b2);p2.add(b3);p1.add(b4);p2.add(b5);p3.add(b6);t1.setText();t2.setText();t3.setText();t4.setText();t5.setText(); setSize(350,300);setVisible(true
8、); try Class.forName(sun.jdbc.odbc.JdbcOdbcDrive); c=DriverManager.getConnection(jdbc:odbc:sd,sa,null); s=c.createStatement(); r=s.executeQuery(select * from 員工基本信息表); catch (SQLException e) JOptionPane.showMessageDialog(null ,e.getMessage(),操作錯(cuò)誤!,JOptionPane.ERROR_MESSAGE); System.exit(1); catch(Cl
9、assNotFoundException e) JOptionPane.showMessageDialog(null ,e.getMessage(),驅(qū)動(dòng)程序找不到!,JOptionPane.ERROR_MESSAGE); System.exit(1); addWindowListener( new WindowAdapter() public void windowClosing(WindowEvent event) try s.close();c.close(); catch(SQLException e) JOptionPane.showMessageDialog(null,e.getM
10、essage(),不能關(guān)閉!,JOptionPane.ERROR_MESSAGE); System.exit(1); ); b1.addActionListener( new ActionListener() public void actionPerformed(ActionEvent event) try r=s.executeQuery(select * from 員工基本信息表 + where 員工編號(hào)=+t1.getText()+); if(r.next() t1.setText(r.getString(1); t2.setText(r.getString(2); t3.setTex
11、t(r.getString(3); t4.setText(r.getString(4); t5.setText(r.getString(5); JOptionPane.showMessageDialog(null,查詢成功!,查詢操作,JOptionPane.ERROR_MESSAGE); else t2.setText();t3.setText();t4.setText();t5.setText(); JOptionPane.showMessageDialog(null,查詢失敗!,查詢操作,JOptionPane.ERROR_MESSAGE); catch(NumberFormatExce
12、ption e) System.out.println(e); catch(SQLException e) System.out.println(e); ); b2.addActionListener( new ActionListener() public void actionPerformed(ActionEvent event) String v1,v2,v3,v4,v5; v1=t1.getText();v2=t2.getText();v3=t3.getText();v4=t4.getText();v5=t5.getText(); if(!v1.equals( )&(!v2.equa
13、ls()&(!v3.equals()&(!v4.equals()&(!v5.equals() try int n1 = Integer.parseInt(v4); int r1 = s.executeUpdate(INSERT INTO 員工基本信息表+ values(+v1+,+v2+,+v3+,+n1+,+v5+); if(r1!=0) t1.setText();t2.setText();t3.setText();t4.setText();t5.setText(); JOptionPane.showMessageDialog(null,插入成功!,插入操作,JOptionPane.ERRO
14、R_MESSAGE); catch (NumberFormatException e )System.out.println(e); catch (SQLException e)System.out.println(e); elseJOptionPane.showMessageDialog(null,插入失敗!,插入操作,JOptionPane.ERROR_MESSAGE); ); b3.addActionListener( new ActionListener() public void actionPerformed(ActionEvent event) try int r1=s.exec
15、uteUpdate(update 員工基本信息表 set 姓名=+t2.getText()+, + 性別=+t3.getText()+, + 年齡=+Integer.parseInt(t4.getText()+, + 部門=+t5.getText()+ where 員工編號(hào)=+t1.getText()+); if(r1!=0) JOptionPane.showMessageDialog(null,修改成功!,修改操作,JOptionPane.ERROR_MESSAGE); elseJOptionPane.showMessageDialog(null,修改失敗!,修改操作,JOptionPane
16、.ERROR_MESSAGE); catch (NumberFormatException e )System.out.println(e); catch (SQLException e)System.out.println(e);); b4.addActionListener(new ActionListener() public void actionPerformed(ActionEvent event) try int r1=s.executeUpdate(delete from 員工基本信息表+where 員工編號(hào)=+t1.getText()+); if(r1!=0) t1.setT
17、ext();t2.setText();t3.setText();t4.setText();t5.setText(); JOptionPane.showMessageDialog(null,刪除成功!,刪除操作,JOptionPane.ERROR_MESSAGE); elseJOptionPane.showMessageDialog(null,刪除失敗!,刪除操作,JOptionPane.ERROR_MESSAGE); catch (NumberFormatException e )System.out.println(e); catch (SQLException e)System.out.p
18、rintln(e); ); b5.addActionListener(new ActionListener() public void actionPerformed(ActionEvent event) t1.setText();t2.setText();t3.setText();t4.setText();t5.setText(); ); b6.addActionListener(new ActionListener() public void actionPerformed(ActionEvent event) try if(r.next() t1.setText(r.getString(1);t2.setText(r.getString(2); t3.setText(r.getString(3);t4.setText(+r.getInt(4
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 產(chǎn)品銷售工作總結(jié)(15篇)
- 民族代表人士活動(dòng)方案
- 櫻花粘土活動(dòng)方案
- 母嬰孕婦活動(dòng)方案
- 正規(guī)別墅裝修活動(dòng)方案
- 植樹節(jié)夢(mèng)幻花園活動(dòng)方案
- 母親節(jié)大學(xué)生活活動(dòng)方案
- 模擬招聘會(huì)活動(dòng)方案
- 油庫(kù)勞動(dòng)活動(dòng)方案
- 正畸沙龍活動(dòng)方案
- 2022-2023學(xué)年廣西北海市七年級(jí)(下)期末地理試卷(含解析)
- 醫(yī)院戰(zhàn)略管理如何制定醫(yī)院戰(zhàn)略規(guī)劃講座
- 部編版語(yǔ)文二年級(jí)下冊(cè)第4單元童心童趣大單元整體作業(yè)設(shè)計(jì)
- SYB創(chuàng)業(yè)培訓(xùn)游戲模塊2課件
- 娛樂場(chǎng)所文明服務(wù)責(zé)任書
- 獸醫(yī)傳染病學(xué)(山東聯(lián)盟)智慧樹知到答案章節(jié)測(cè)試2023年青島農(nóng)業(yè)大學(xué)
- 鋼結(jié)構(gòu)防腐油漆施工方案
- 第五講社會(huì)建設(shè)
- GB/T 35273-2020信息安全技術(shù)個(gè)人信息安全規(guī)范
- GB/T 20303.1-2006起重機(jī)司機(jī)室第1部分:總則
- GB 18068-2000水泥廠衛(wèi)生防護(hù)距離標(biāo)準(zhǔn)
評(píng)論
0/150
提交評(píng)論