學(xué)生學(xué)籍管理系統(tǒng)(含java源代碼)_第1頁(yè)
學(xué)生學(xué)籍管理系統(tǒng)(含java源代碼)_第2頁(yè)
學(xué)生學(xué)籍管理系統(tǒng)(含java源代碼)_第3頁(yè)
學(xué)生學(xué)籍管理系統(tǒng)(含java源代碼)_第4頁(yè)
學(xué)生學(xué)籍管理系統(tǒng)(含java源代碼)_第5頁(yè)
已閱讀5頁(yè),還剩17頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、精選文檔同學(xué)學(xué)籍管理具體設(shè)計(jì) 學(xué)號(hào):_ 姓名:_ 班級(jí):_1、 設(shè)計(jì)題目:同學(xué)學(xué)籍管理二:設(shè)計(jì)內(nèi)容: 設(shè)計(jì)GUI同學(xué)學(xué)籍管理界面,用戶可以加入同學(xué)信息,并對(duì)基本信息進(jìn)行修改,添加,查詢,刪除。三:設(shè)計(jì)要求: 進(jìn)行簡(jiǎn)潔的同學(xué)信息管理。四:總體設(shè)計(jì) (1)登陸界面的設(shè)計(jì) (2)主窗體的設(shè)計(jì) (3)添加同學(xué)信息窗體 (4)查詢同學(xué)信息窗體 (5)修改同學(xué)信息窗體 (6)刪除同學(xué)信息窗體 (7)大事響應(yīng)的處理五:具體設(shè)計(jì)(1) 程序結(jié)構(gòu)的說(shuō)明:A. 入口程序:student.java;B. 登陸界面程序:mainframe.java;C. 主窗體程序:interfac.java;D. 添加信息窗口程序

2、:tj.java;E. 修改信息窗口程序:xg.java;F. 查詢信息窗口程序:cx.java;G. 刪除信息窗口程序:sc.java;H. 程序數(shù)據(jù)連接:DatabaseConn.java;(2) 程序代碼及分析說(shuō)明A.程序源代碼(已提交)B.Student.java是程序的入口。使登錄窗口位于窗口中間,并且不行轉(zhuǎn)變窗口大小。C.mainframe.java是程序的登陸窗體。輸入用戶名和密碼(用戶名和密碼在數(shù)據(jù)庫(kù)的password表中)點(diǎn)擊“進(jìn)入系統(tǒng)”,然后登陸界面消逝;消滅要操作的界面(屏幕左上角)。D.tj.java是添加信息界面。添加基本信息后,點(diǎn)擊“添加信息”按鈕,將信息加入xin

3、xi表中。E.xg.java是修改信息界面。輸入要修改的學(xué)號(hào)或姓名(兩者數(shù)其一或全部輸入),并輸入全部信息,點(diǎn)擊“修改信息”按鈕(假如數(shù)據(jù)庫(kù)中不存在此學(xué)號(hào),則彈出對(duì)話框“無(wú)此同學(xué)信息”),若有則修改。F.sc.java是刪除信息界面。輸入要?jiǎng)h除的同學(xué)的學(xué)號(hào),點(diǎn)擊“刪除信息”按鈕,彈出確認(rèn)刪除對(duì)話框,即可刪除該生信息。G.cx.java是查詢信息界面。輸入要查詢的同學(xué)學(xué)號(hào),點(diǎn)擊“信息查詢”按鈕,在相應(yīng)的文本區(qū)里顯示查詢的信息。H:源代碼/student.java:程序的入口。初始化界面,使主界面位于屏幕中間,且用戶不能轉(zhuǎn)變大小/功能:完成程序的執(zhí)行挨次import javax.swing.UIM

4、anager;import java.awt.*;import java.sql.*;/import screenpublic class studentboolean packFrame=false;/JFrame frame=new JFrame();public student()mainframe frame=new mainframe();if(packFrame)frame.pack();else frame.validate();Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();Dimension f

5、rameSize=frame.getSize();if(frameSize.height>screenSize.height)frameSize.height=screenSize.height;if(frameSize.width>screenSize.width)frameSize.width=screenSize.width;frame.setLocation(screenSize.width-frameSize.width)/2,(screenSize.height-frameSize.height)/2);frame.setVisible(true);public sta

6、tic void main(String args)tryUIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName();catch(Exception e)e.printStackTrace();new student();/數(shù)據(jù)庫(kù)連接/package sql.database;import java.sql.*;public class DatabaseConnprivate static String user=""private static String password=""

7、;private Connection conn=null;private Statement stmt=null;private ResultSet rs=null;static tryClass.forName("sun.jdbc.odbc.JdbcOdbcDriver");/加載驅(qū)動(dòng) catch(ClassNotFoundException e)/創(chuàng)建數(shù)據(jù)庫(kù)連接對(duì)象public Connection getConnection()tryconn=DriverManager.getConnection("jdbc:odbc:stu",user,pas

8、sword);return conn;catch(SQLException e)return null;public Statement createStat()tryconn=getConnection();stmt=conn.createStatement();return stmt;catch(SQLException e)return null;public ResultSet getRs(String sql) try conn=getConnection();/. stmt=createStat(); rs=stmt.executeQuery(sql); return rs; ca

9、tch(SQLException e) return null; public void close() try if(rs!=null) rs.close(); if(stmt!=null) stmt.close(); if(conn!=null) conn.close(); catch(SQLException ex) ex.printStackTrace(); /mainframe.javaimport java.awt.*;import java.awt.event.*;import javax.swing.*;import java.sql.*;public class mainfr

10、ame extends JFrame implements ActionListenerstatic mainframe s;static JPanel pan=new JPanel();static JLabel label1 = new JLabel("用 戶"); static JLabel label2 = new JLabel("密 碼"); static JTextField textField1 = new JTextField(); static JPasswordField password = new JPasswordField()

11、; static JButton button1 = new JButton("進(jìn)入系統(tǒng)"); static JRadioButton radioButton1=new JRadioButton("管理員",true);/“管理員”初始狀態(tài)被選中 static JRadioButton radioButton2=new JRadioButton("同學(xué)"); static JRadioButton radioButton3=new JRadioButton("老師"); ButtonGroup buttonGrou

12、p=new ButtonGroup(); public mainframe()JLabel label=new JLabel(new ImageIcon("圖片44.jpg");label.setSize(400,400);pan.add(label);pan.setLayout(null);pan.setSize(400,400);this.setTitle("學(xué)籍管理系統(tǒng)");this.setSize(400,400);this.setLayout(null);label1.setBounds(100,25,49,20);textField1.set

13、Bounds(155,24,120,20);label2.setBounds(100,62,49,20);password.setBounds(155,61,120,20);button1.setBounds(150,200,101,22); radioButton1.setBounds(105,120,80,20); radioButton2.setBounds(180,120,60,20);radioButton3.setBounds(240,120,60,20);button1.addActionListener(this);buttonGroup.add(radioButton1);

14、buttonGroup.add(radioButton2);buttonGroup.add(radioButton3);this.add(radioButton1);this.add(radioButton2);this.add(radioButton3);this.add(label1);this.add(label2);this.add(textField1);this.add(password);this.add(button1);this.add(pan);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setVisib

15、le(true); public static void main(String args) new mainframe(); public void actionPerformed(ActionEvent e) if(radioButton1.isSelected()/管理員 if(textField1.getText().equals("syc") && password.getText().equals("123")interfac b=new interfac();this.dispose();/JOptionPane.showM

16、essageDialog(null,"登陸成功");else if("".equals(textField1.getText() | "".equals(password.getText() )JOptionPane.showMessageDialog(null,"用戶名或密碼不能為空");else JOptionPane.showMessageDialog(null,"用戶名或密碼輸入有誤");if(radioButton2.isSelected()/同學(xué) tryClass.forName(&

17、quot;sun.jdbc.odbc.JdbcOdbcDriver");catch (ClassNotFoundException ce)JOptionPane.showMessageDialog(s,ce.getMessage();tryConnection con = DriverManager.getConnection("jdbc:odbc:stu","sa","");Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(&q

18、uot;select * from password where 用戶名 = '"+textField1.getText()+"' and 密碼 = '"+password.getText()+"'"); if(textField1.getText().equals("")|password.getText().equals("") JOptionPane.showMessageDialog(this,"用戶名或密碼不行為空!"); else if(rs

19、.next() new interfac(); else JOptionPane.showMessageDialog(this,"您的輸入有誤"); /stmt.close(); catch (SQLException se)JOptionPane.showMessageDialog(s,se.getMessage();/interface.javaimport java.awt.*;import java.awt.event.*;import javax.swing.*;public class interfac extends JFrame implements Act

20、ionListenerstatic JMenuBar jMenuBar = new JMenuBar();/菜單條 static JMenu jMenuFile = new JMenu("文件");/菜單項(xiàng) static JMenu jMenuExit = new JMenu("退出"); static JMenuItem jMenuItem1 = new JMenuItem("添加信息");/菜單子項(xiàng) static JMenuItem jMenuItem2 = new JMenuItem("修改信息"); sta

21、tic JMenuItem jMenuItem3 = new JMenuItem("信息查詢"); static JMenuItem jMenuItem4 = new JMenuItem("刪除信息"); static JLabel label3 = new JLabel("請(qǐng)選擇操作項(xiàng)"); static JLabel label4 = new JLabel("學(xué)籍管理系統(tǒng)"); static JButton button2 = new JButton("添加信息"); static JBut

22、ton button3 = new JButton("修改信息"); static JButton button4 = new JButton("信息查詢"); static JButton button5 = new JButton("刪除信息"); public interfac()this.setTitle("學(xué)籍管理系統(tǒng)");this.setLayout(null);this.setSize(400,400);label3.setBounds(158,92,98,33);label3.setFont(new

23、 Font("Dialog",Font.PLAIN,15);label4.setFont(new Font("Dialog",Font.BOLD,20);label4.setBounds(157,37,280,40);button2.setBounds(74,136,97,33);button3.setBounds(226,136,97,33);button4.setBounds(74,185,97,33);button5.setBounds(226,185,97,33);this.add(button2);this.add(button3);this.

24、add(button4);this.add(button5);this.add(label3);this.add(label4);setJMenuBar(jMenuBar);jMenuFile.add(jMenuItem1);/”文件“菜單項(xiàng)中加入子菜單 jMenuFile.add(jMenuItem2); jMenuFile.add(jMenuItem3); jMenuFile.add(jMenuItem4); jMenuBar.add(jMenuFile);/將菜單項(xiàng)加入菜單條 jMenuBar.add(jMenuExit); button2.addActionListener(this)

25、;/本窗口向按鈕大事源注冊(cè) button3.addActionListener(this); button4.addActionListener(this); button5.addActionListener(this); jMenuItem1.addActionListener(this);/本窗口菜單子項(xiàng)注冊(cè) jMenuItem2.addActionListener(this); jMenuItem3.addActionListener(this); jMenuItem4.addActionListener(this); jMenuExit.addActionListener(this)

26、; this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setVisible(true);public static void main(String args)interfac a=new interfac(); public void actionPerformed(ActionEvent e) /按鈕大事的處理 if(e.getSource()=jMenuExit) System.exit(0); else if(e.getSource()=jMenuItem1|e.getSource()=button2) try tj a

27、=new tj(); catch(Exception ee) else if(e.getSource()=jMenuItem2|e.getSource()=button3) try xg a=new xg(); catch(Exception ed) else if(e.getSource()=jMenuItem3|e.getSource()=button4) try cx a=new cx(); catch(Exception ec) else if(e.getSource()=jMenuItem4|e.getSource()=button5) try sc a=new sc(); catc

28、h(Exception es) /tj.java 添加界面import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.*;public class tj extends JFrame implements ActionListener static tj s; static JLabel label1 = new JLabel("學(xué)號(hào):"); static JTextField textField1 = new JTextField(""); static

29、JLabel label2 = new JLabel("姓名:"); static JTextField textField2 = new JTextField(""); static JLabel label3 = new JLabel("性別:"); static JTextField textField7=new JTextField(""); static JLabel label4 = new JLabel("誕生日期:"); static JTextField textField3

30、= new JTextField(""); static JLabel label5 = new JLabel("政治面貌:"); static JTextField textField8=new JTextField(""); static JLabel label6 = new JLabel("籍貫"); static JTextField textField4 = new JTextField(""); static JLabel label7 = new JLabel("系別:

31、"); static JTextField textField9 = new JTextField(""); static JLabel label8 = new JLabel("專業(yè):"); static JTextField textField5 = new JTextField(""); static JButton button1 = new JButton("增加"); public tj() this.setTitle("增加同學(xué)信息"); this.setLayout(n

32、ull); this.setSize(400,400); label1.setBounds(30, 11, 51, 33); textField1.setBounds(86, 16, 74, 22); label2.setBounds(162, 11, 51, 33); textField2.setBounds(192, 16, 44, 22); label3.setBounds(241, 11, 70, 33); textField7.setBounds(275, 15, 50, 25); label4.setBounds(31, 53, 55, 33); textField3.setBou

33、nds(86, 58, 74, 22); label5.setBounds(241, 53, 70, 33); textField8.setBounds(296, 57, 72, 25); label6.setBounds(163, 53, 26, 33); textField4.setBounds(191, 58, 44, 22); label7.setBounds(30, 94, 50, 33); textField9.setBounds(86,94,74,22); label8.setBounds(163, 94, 51, 33); textField5.setBounds(190, 9

34、9, 178, 22); button1.setBounds(25,241,80,33); button1.addActionListener(this); this.add(label1); this.add(label2); this.add(label3); this.add(label4); this.add(label5); this.add(label6); this.add(label7); this.add(label8); this.add(textField1); this.add(textField2); this.add(textField3); this.add(te

35、xtField4); this.add(textField5); this.add(textField7); this.add(textField8); this.add(textField9); this.add(button1); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setVisible(true); public static void main(String args) throws Exception tj a=new tj(); a.setDefaultCloseOperation(JFrame.

36、EXIT_ON_CLOSE); public void actionPerformed(ActionEvent e)/大事處理程序 if (e.getSource() = button1) tryClass.forName("sun.jdbc.odbc.JdbcOdbcDriver");catch (ClassNotFoundException ce)JOptionPane.showMessageDialog(s,ce.getMessage();tryConnection con = DriverManager.getConnection("jdbc:odbc:s

37、tu","sa"," ");Statement stmt = con.createStatement(); ResultSet rs=stmt.executeQuery("select * from xinxi where 學(xué)號(hào)='"+textField1.getText()+"'"); if(rs.next() JOptionPane.showMessageDialog(null,"此學(xué)號(hào)已經(jīng)被注冊(cè)"); else stmt.execute("insert

38、into xinxi (學(xué)號(hào),姓名,性別,誕生日期,政治面貌,籍貫,系別,專業(yè)) values ('"+ textField1.getText()+"','"+textField2.getText()+"','"+textField7.getText()+"','"+ textField3.getText()+"','"+textField8.getText()+"','"+textField4.g

39、etText()+"','"+ textField9.getText()+"','"+textField5.getText()+"')"); JOptionPane.showMessageDialog(null,"添加信息成功"); catch (SQLException se)JOptionPane.showMessageDialog(s,se.getMessage(); /xg.java 修改界面import javax.swing.*;import java.awt.*

40、;import java.awt.event.*;import java.sql.*;public class xg extends JFrame implements ActionListener static xg s; static JLabel label1 = new JLabel("學(xué)號(hào):"); static JTextField textField1 = new JTextField(""); static JLabel label2 = new JLabel("姓名:"); static JTextField text

41、Field2 = new JTextField(""); static JLabel label3 = new JLabel("性別:"); static JTextField textField7=new JTextField(""); static JLabel label4 = new JLabel("誕生日期:"); static JTextField textField3 = new JTextField(""); static JLabel label5 = new JLabel(&

42、quot;政治面貌:"); static JTextField textField8=new JTextField(""); static JLabel label6 = new JLabel("籍貫"); static JTextField textField4 = new JTextField(""); static JLabel label7 = new JLabel("系別:"); static JTextField textField9 = new JTextField(""

43、); static JLabel label8 = new JLabel("專業(yè):"); static JTextField textField5 = new JTextField(""); static JButton button2=new JButton("修改"); public xg() this.setTitle("修改同學(xué)信息"); this.setLayout(null); this.setSize(400,400); label1.setBounds(30, 11, 51, 33); textFi

44、eld1.setBounds(86, 16, 74, 22); label2.setBounds(162, 11, 51, 33); textField2.setBounds(192, 16, 44, 22); label3.setBounds(241, 11, 70, 33); textField7.setBounds(275, 15, 50, 25); label4.setBounds(31, 53, 55, 33); textField3.setBounds(86, 58, 74, 22); label5.setBounds(241, 53, 70, 33); textField8.se

45、tBounds(296, 57, 72, 25); label6.setBounds(163, 53, 26, 33); textField4.setBounds(191, 58, 44, 22); label7.setBounds(30, 94, 50, 33); textField9.setBounds(86,94,74,22); label8.setBounds(163, 94, 51, 33); textField5.setBounds(190, 99, 178, 22); button2.setBounds(115,241,80,33); button2.addActionListe

46、ner(this); this.add(label1); this.add(label2); this.add(label3); this.add(label4); this.add(label5); this.add(label6); this.add(label7); this.add(label8); this.add(textField1); this.add(textField2); this.add(textField3); this.add(textField4); this.add(textField5); this.add(textField7); this.add(text

47、Field8); this.add(textField9); this.add(button2); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setVisible(true); public static void main(String args) throws Exception xg a=new xg(); a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); public void actionPerformed(ActionEvent e)/大事處理程序 if

48、(e.getSource()=button2) tryClass.forName("sun.jdbc.odbc.JdbcOdbcDriver");catch (ClassNotFoundException ce)JOptionPane.showMessageDialog(s,ce.getMessage();tryConnection con = DriverManager.getConnection("jdbc:odbc:stu","sa","");Statement stmt = con.createStatem

49、ent(); ResultSet rs=stmt.executeQuery("select * from xinxi where 學(xué)號(hào)='"+textField1.getText()+"'"); if(textField1.getText().trim().equals("") JOptionPane.showMessageDialog(this,"學(xué)號(hào)不行為空!"); else if(rs.next() String updateSql="update xinxi set 學(xué)號(hào)='

50、;"+textField1.getText()+"', 姓名='"+ textField2.getText()+"',性別='"+textField7.getText()+"',出生日期='"+ textField3.getText()+"',政治面貌='"+textField8.getText()+"',籍貫='"+ textField4.getText()+"',系別='&qu

51、ot;+textField9.getText()+"',專業(yè)='"+ textField5.getText()+ "'" try stmt.executeQuery(updateSql); catch(SQLException se) JOptionPane.showMessageDialog(null,"修改成功"); catch(SQLException se) JOptionPane.showMessageDialog(s,se.getMessage(); /sc.java 刪除界面import javax.swing.*;import java.awt.*;import

溫馨提示

  • 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ù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 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ì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論