




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、4.2設(shè)計(jì)代碼Java源程序:import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.awt.*;import java.sql.*;import java.lang.*; import java.util.*; import javax.swing.table.*;import java.math.*; class DB_LS implements ActionListenerJFrame frame=new JFrame("歡迎進(jìn)入LS工資管理系統(tǒng)");JLabel label
2、=new JLabel("09網(wǎng)絡(luò)2_54_李勝",JLabel.CENTER);JButton button1=new JButton("進(jìn)入系統(tǒng)");JButton button2=new JButton("退出系統(tǒng)");ImageIcon im=new ImageIcon("1.jpg"); JLabel a1=new JLabel(im);void Create()JPanel pcontentPane=(JPanel)frame.getContentPane();JPanel pcontentPane1=
3、new JPanel();pcontentPane.add(label);pcontentPane.setLayout(new FlowLayout();pcontentPane.add(button1);pcontentPane.add(button2);pcontentPane.add(new Label(" ");pcontentPane.add(a1);pcontentPane.setBackground(Color.green);pcontentPane.setVisible(true);button1.addActionListener(this); butto
4、n2.addActionListener(this);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack();frame.setBounds(200,100,550,600);frame.setVisible(true);public static void main(String args)DB_LS dome=new DB_LS();dome.Create(); public void actionPerformed(ActionEvent e) if(button1.equals(e.getSource() DL
5、 dl=new DL(); dl.create(); if(button2.equals(e.getSource()/退出System.exit(0); class DL implements ActionListenerJFrame frame=new JFrame("職工/管理員登陸");JLabel label1=new JLabel("用戶名");JLabel label2=new JLabel("密碼");JButton logonButton1=new JButton("管理員登錄");JButton
6、logonButton2=new JButton("職工登錄");JButton cancelButton=new JButton("退出");JTextField t1=new JTextField(0);JTextField t2=new JTextField(0);ImageIcon im=new ImageIcon("2.jpg"); JLabel a2=new JLabel(im);JTextField username=new JTextField(9);JPasswordField password=new JPassw
7、ordField(9);void create()JPanel p=(JPanel)frame.getContentPane();JPanel p1=new JPanel();p.setLayout(new FlowLayout();p.add(label1);p.setSize(5,5);p.setLocation(4,8);p.add(username);p.setSize(100,200);p.setLocation(800,800);p.add(label2);p.setSize(50,20);p.setLocation(40,80);p.add(password);p.setSize
8、(100,20);p.setLocation(80,120);p.add(logonButton1);p.add(new JLabel(" ");p.add(logonButton2);p.add(new JLabel(" ");p.add(cancelButton);p.add(new JLabel(" ");p.add(a2);p.add(t1);p.add(t2);p.setBackground(Color.blue);p.setVisible(true);logonButton1.addActionListener(this)
9、;logonButton2.addActionListener(this); cancelButton.addActionListener(this); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.pack(); frame.setBounds(200,100,750,550); frame.setVisible(true);public void actionPerformed(ActionEvent e) if(logonButton1.equals(e.getSource()&&(username.
10、getText().equals("123")=true)&&(password.getText().equals("123")=true)GZGLZJM gz=new GZGLZJM();gz.create();elseJOptionPane.showMessageDialog(null,"對(duì)不起,你輸入的密碼錯(cuò)誤!");if(logonButton2.equals(e.getSource()&&(username.getText().equals(t1.getText()=true)&&am
11、p;(password.getText().equals(t2.getText()=true)XK xk=new XK();xk.create(); Connection con; Statement sql; ResultSet rs; Vector vector=new Vector(); try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); catch (ClassNotFoundException e1) System.out.println("" + e1);try con = DriverMan
12、ager.getConnection("jdbc:odbc:123", "", "");sql = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); sql.executeQuery("SELECT Gno,mm FROM Y WHERE Gno="+t1.getText() +"AND mm="+t2.getText();catch (SQLException e1) System.
13、out.println(e1); if(cancelButton.equals(e.getSource()System.exit(0); class GZGLZJM extends JFrame implements ActionListener JFrame f=new JFrame("工資管理系統(tǒng)"); JButton b1=new JButton("津貼管理"); JButton b2=new JButton("總查詢"); JButton b3=new JButton("工資管理"); JButton b4
14、=new JButton("后勤管理"); JButton b6=new JButton("員工個(gè)人信息管理"); JButton b5=new JButton("返回"); ImageIcon im=new ImageIcon("3.jpg"); JLabel a3=new JLabel(im); void create() JPanel p=(JPanel)f.getContentPane(); JPanel p1=new JPanel(); p.setLayout(new FlowLayout(); p.ad
15、d(b1); p.add(new JLabel(" "); p.add(b6); p.add(new JLabel(" "); p.add(b3); p.add(new JLabel(" "); p.add(b4); p.add(new JLabel(" "); p.add(b2); p.add(new JLabel(" "); p.add(b5); p.add(a3); p.setBackground(Color.red); p.setVisible(true); b1.addActionLi
16、stener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); b5.addActionListener(this); b6.addActionListener(this); f.setBounds(200,100,800,600); f.setVisible(true); public void actionPerformed(ActionEvent e) if(b5.equals(e.getSource()/返回 DL d=new DL(); f.dispos
17、e(); if(b1.equals(e.getSource()/津貼管理 JTGL jt=new JTGL(); jt.create(); if(b6.equals(e.getSource()/員工個(gè)人信息管理 YGGL yg=new YGGL(); yg.create(); if(b2.equals(e.getSource()/查詢 XK xk=new XK(); xk.create(); if(b4.equals(e.getSource()/后勤管理 KQGL kq=new KQGL(); kq.create(); if(b3.equals(e.getSource()/工資管理 GZGL
18、gz=new GZGL(); gz.create(); class KQGL implements ActionListener JFrame f=new JFrame("錄入修改刪除考勤信息"); JButton b1=new JButton("錄入"); JButton b2=new JButton("修改"); JButton b3=new JButton("刪除"); JButton b4=new JButton("查詢所有"); JButton b5=new JButton("
19、;返回"); JTextField tf1=new JTextField(4); JTextField tf2=new JTextField(4); JTextField tf3=new JTextField(4); JTextField tf4=new JTextField(4); JTextField tf5=new JTextField(6); JButton b6=new JButton("查詢單人考勤"); String cloum="職工號(hào)","缺勤天數(shù)","缺勤類別","缺勤時(shí)間&
20、quot; Object row=new Object504; JTable table=new JTable(row,cloum); JScrollPane scrollpane=new JScrollPane(table); JSplitPane splitpane=new JSplitPane(JSplitPane.VERTICAL_SPLIT); void create() JPanel p=(JPanel)f.getContentPane(); p.setLayout(new FlowLayout(); /p.add(scrollpane); p.add(splitpane); JP
21、anel p1=new JPanel(); p1.add(b1); p1.add(b2); p1.add(b3); p1.add(b4); p1.add(b6); p1.add(b5); JPanel p2=new JPanel(); p2.setBackground(Color.red); p2.add(scrollpane); JPanel p3=new JPanel(); p.setLayout(new FlowLayout(); p.add(new JLabel(""); p.add(new JLabel("職工號(hào)"); p.add(tf1);
22、p.add(new JLabel("缺勤天數(shù)"); p.add(tf2); p.add(new JLabel("缺勤類別"); p.add(tf3); p.add(new JLabel(""); p.add(new JLabel("缺勤時(shí)間"); p.add(tf4); p.add(new JLabel(" 在此處輸入職工號(hào)點(diǎn)擊查詢刪除"); p.add(tf5); splitpane.add(p1,splitpane.TOP); splitpane.add(p2,splitpane.BOTTO
23、M); splitpane.setDividerLocation(50); p.setBackground(Color.CYAN); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); b5.addActionListener(this); b6.addActionListener(this); f.setBounds(200,100,500,600); f.setResizable(true);/可以調(diào)整界面大小 f.se
24、tVisible(true); public void actionPerformed(ActionEvent e) if(b1.equals(e.getSource() /添加 Connection con;Statement sql;ResultSet rs;try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); catch (ClassNotFoundException e1) System.out.println("" + e1);try con = DriverManager.getConnecti
25、on("jdbc:odbc:123", "", ""); sql = con.createStatement(); String insertStr = "INSERT INTO K VALUES " + "(" + "'" + tf1.getText() + "'" + "," + tf2.getText()+"," + "'" +tf3.getText()+"
26、'" + ","+tf4.getText()+")" sql.executeUpdate(insertStr); con.close(); catch (SQLException e1) System.out.println(e1); if(b2.equals(e.getSource()/修改Connection con;Statement sql;ResultSet rs;try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); catch (ClassNotFoundE
27、xception e1) System.out.println("" + e1);try con = DriverManager.getConnection("jdbc:odbc:123", "", ""); sql = con.createStatement(); sql.executeUpdate("UPDATE K SET ts="+tf2.getText()+"WHERE Kno="+tf1.getText()+""); sql.executeUp
28、date("UPDATE K SET lb="+tf3.getText()+"WHERE Kno="+tf1.getText()+""); sql.executeUpdate("UPDATE K SET sj="+tf4.getText()+"WHERE Kno="+tf1.getText()+""); con.close(); catch (SQLException e1) System.out.println(e1); if(b3.equals(e.getSource()
29、/刪除 Connection con;Statement sql;ResultSet rs;try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); catch (ClassNotFoundException e1) System.out.println("" + e1);try con = DriverManager.getConnection("jdbc:odbc:123", "", ""); sql = con.createStatement(R
30、esultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); sql.executeUpdate("DELETE FROM K WHERE Kno="+tf5.getText(); con.close(); catch (SQLException e1) System.out.println(e1); if(b4.equals(e.getSource()/查詢?nèi)?Connection con; Statement sql; ResultSet rs; Vector vector=new Vector(); try
31、Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); catch (ClassNotFoundException e1) System.out.println("" + e1); try con = DriverManager.getConnection("jdbc:odbc:123", "sa", "");sql = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_
32、READ_ONLY); if(b4.equals(e.getSource()for(int i=0;i<50;i+) for(int j=0;j<4;j+) table.setValueAt("",i,j); rs = sql.executeQuery("SELECT * FROM K ORDER BY Kno DESC"); int k=-1; while(rs.next() +k; String Kno = rs.getString(1); String ts = rs.getString(2); String lb = rs.getString(3); String sj = rs.getString(4); table.setValueAt(Kno,k,0); table.setValueAt(ts,k,
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 家長(zhǎng)對(duì)教育機(jī)構(gòu)的選擇與評(píng)價(jià)
- 主軸防護(hù)管理制度
- 樂巢規(guī)章管理制度
- 事故瞞報(bào)管理制度
- 互動(dòng)教室管理制度
- 井下通訊管理制度
- 井筒安全管理制度
- 交房流程管理制度
- 交際費(fèi)用管理制度
- 產(chǎn)品戰(zhàn)略管理制度
- 2025年四川省涼山州中考數(shù)學(xué)試卷真題及解析答案
- 2025年上半年山東鐵投集團(tuán)校園招聘社會(huì)公開招聘165人筆試參考題庫附帶答案詳解
- 2025年江蘇省金陵中學(xué)英語八下期末學(xué)業(yè)質(zhì)量監(jiān)測(cè)試題含答案
- DB31-T 1545-2025 衛(wèi)生健康數(shù)據(jù)分類分級(jí)要求
- 【薪智】2025地產(chǎn)建筑業(yè)行業(yè)白皮書人力核心指標(biāo)行業(yè)報(bào)告系列
- 監(jiān)護(hù)證考試試題及答案
- 2022石油化工消防設(shè)施維護(hù)保養(yǎng)技術(shù)標(biāo)準(zhǔn)
- 建辦質(zhì)202463號(hào)危險(xiǎn)性較大的分部分項(xiàng)工程專項(xiàng)施工方案嚴(yán)重缺陷清單宣貫(雄安)
- 設(shè)備電氣接線規(guī)范
- 2024-2025學(xué)年七年級(jí)下學(xué)期數(shù)學(xué)期中測(cè)試(浙江杭州市專用)(含答案)
- 寧波鄞州區(qū)輔警考試題庫
評(píng)論
0/150
提交評(píng)論