基于JAVA的學(xué)生成績(jī)管理系統(tǒng)源代碼(1)參考模板_第1頁(yè)
基于JAVA的學(xué)生成績(jī)管理系統(tǒng)源代碼(1)參考模板_第2頁(yè)
基于JAVA的學(xué)生成績(jī)管理系統(tǒng)源代碼(1)參考模板_第3頁(yè)
基于JAVA的學(xué)生成績(jī)管理系統(tǒng)源代碼(1)參考模板_第4頁(yè)
基于JAVA的學(xué)生成績(jī)管理系統(tǒng)源代碼(1)參考模板_第5頁(yè)
已閱讀5頁(yè),還剩14頁(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、Java程序設(shè)計(jì)系 專 業(yè)班 級(jí)學(xué) 號(hào) 15號(hào)姓 名 劉振基題 目 學(xué)生成績(jī)管理系統(tǒng)任課教師 彭杰1 / 19一:要求1、 用到書上(課本或?qū)嶒?yàn)冊(cè))上的至少三個(gè)實(shí)例2、 用到至少兩種布局和至少四種組件3、 用到對(duì)話框4、 用到對(duì)數(shù)據(jù)庫(kù)的查詢、刪除、添加和修改5、 最好用到輸入輸出流6、 具有一定的實(shí)際意義二:內(nèi)容 本系統(tǒng)用access作為數(shù)據(jù)庫(kù),用到了書上的布局實(shí)例和數(shù)據(jù)庫(kù)連接實(shí)例功能: 1、輸入十個(gè)同學(xué)的學(xué)號(hào),姓名,出生日期,二科成績(jī)(學(xué),大學(xué)英語(yǔ)) 。2、輸入學(xué)號(hào)查詢學(xué)生信息。 3、刪除記錄4、查詢記錄5、添加記錄6、修改記錄三:代碼第一部分:public class main publi

2、c static void main(String args) zhuchuangkou win=new zhuchuangkou();第二部分主界面:import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.*;public class zhuchuangkou extends Frame implements ActionListenerButton button1,button2,button3,button4,tuichu;Panel p1,p2,p3;Label l

3、1,l2,l3;TextField a1,a2;Box b1,b2,b3,b4,b5;ss s;zhuchuangkou()button1=new Button("登陸");button2=new Button("刪除");button3=new Button("修改");button4=new Button("添加");tuichu=new Button("退出");p1=new Panel();p2=new Panel();p3=new Panel();l1=new Label("

4、學(xué)生成績(jī)管理",Label.CENTER);l1.setFont(new Font("宋體",Font.BOLD,72);l1.setBackground(Color.green);l2=new Label("登錄名");l3=new Label("密碼");a1=new TextField(10);a2=new TextField(10);a2.setEchoChar('*');b1=Box.createVerticalBox();b1.add(l2);b1.add(Box.createVerticalSt

5、rut(8);b1.add(l3);b2=Box.createVerticalBox();b2.add(a1);b2.add(Box.createVerticalStrut(8);b2.add(a2);b4=Box.createHorizontalBox();b4.add(button1);b4.add(Box.createHorizontalStrut(10);b4.add(tuichu);b3=Box.createHorizontalBox();b3.add(b1);b3.add(Box.createHorizontalStrut(10);b3.add(b2);b5=Box.createV

6、erticalBox();b5.add(b3);b5.add(Box.createVerticalStrut(8);b5.add(b4);button1.addActionListener(this);button2.addActionListener(this);button3.addActionListener(this);button4.addActionListener(this);tuichu.addActionListener(this);p1.add(l1);p2.add(b5);add(p1,BorderLayout.NORTH);add(p2,BorderLayout.CEN

7、TER);add(p3,BorderLayout.PAGE_END);addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););setBackground(Color.RED);setBounds(10, 10, 1000, 500);setVisible(true);validate();public void actionPerformed(ActionEvent e)if(e.getSource()=tuichu)System.exit(0);if(e.getSourc

8、e()=button1)if(a1.getText().equals("liuzhenji")&&a2.getText().equals("123456")new chuankou();System.out.println("wwwww");dispose();elseSystem.out.print("nishurucuowu");第三部分選擇操作:import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax

9、.swing.border.*;public class zhuchuangkou extends Frame implements ActionListenerButton button1,button2,button3,button4,tuichu;Panel p1,p2,p3;Label l1,l2,l3;TextField a1,a2;Box b1,b2,b3,b4,b5;ss s;zhuchuangkou()button1=new Button("登陸");button2=new Button("刪除");button3=new Button(

10、"修改");button4=new Button("添加");tuichu=new Button("退出");p1=new Panel();p2=new Panel();p3=new Panel();l1=new Label("學(xué)生成績(jī)管理",Label.CENTER);l1.setFont(new Font("宋體",Font.BOLD,72);l1.setBackground(Color.green);l2=new Label("登錄名");l3=new Label(&q

11、uot;密碼");a1=new TextField(10);a2=new TextField(10);a2.setEchoChar('*');b1=Box.createVerticalBox();b1.add(l2);b1.add(Box.createVerticalStrut(8);b1.add(l3);b2=Box.createVerticalBox();b2.add(a1);b2.add(Box.createVerticalStrut(8);b2.add(a2);b4=Box.createHorizontalBox();b4.add(button1);b4.ad

12、d(Box.createHorizontalStrut(10);b4.add(tuichu);b3=Box.createHorizontalBox();b3.add(b1);b3.add(Box.createHorizontalStrut(10);b3.add(b2);b5=Box.createVerticalBox();b5.add(b3);b5.add(Box.createVerticalStrut(8);b5.add(b4);button1.addActionListener(this);button2.addActionListener(this);button3.addActionL

13、istener(this);button4.addActionListener(this);tuichu.addActionListener(this);p1.add(l1);p2.add(b5);add(p1,BorderLayout.NORTH);add(p2,BorderLayout.CENTER);add(p3,BorderLayout.PAGE_END);addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););setBackground(Color.RED);se

14、tBounds(10, 10, 1000, 500);setVisible(true);validate();public void actionPerformed(ActionEvent e)if(e.getSource()=tuichu)System.exit(0);if(e.getSource()=button1)if(a1.getText().equals("liuzhenji")&&a2.getText().equals("123456")new chuankou();System.out.println("wwwww

15、");dispose();elseSystem.out.print("nishurucuowu");第四部分查詢界面實(shí)現(xiàn):import java.awt.*;import java.awt.event.*;import java.sql.*;import javax.swing.JOptionPane;public class ss extends Frame implements TextListener,ActionListenerButton xunzhao;TextField input;TextArea show;String s;int k;Conne

16、ction con; Statement sql; int sum=0; ResultSet rs;ss()Panel p=new Panel();xunzhao= new Button("查找");input= new TextField(10);show= new TextArea(6,43);p.add(new Label("輸入學(xué)號(hào)");p.add(input);p.add(xunzhao);xunzhao.addActionListener(this);show.addTextListener(this);show.setEditable(fa

17、lse);add(p,BorderLayout.NORTH);add(show,BorderLayout.CENTER);setBounds(10,30,500,200);setVisible(true);validate();addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););public void actionPerformed(ActionEvent ee) boolean boo=true;s=input.getText();k=Integer.parseInt

18、(s);try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); catch(ClassNotFoundException eee) System.out.println(""+eee); try con=DriverManager.getConnection("jdbc:odbc:sun","gxy","123"); sql=con.createStatement(); rs=sql.executeQuery("SELECT * FROM

19、chengjibiao "); while(rs.next() int number=rs.getInt("number"); String name=rs.getString("name"); String date=rs.getString("birthday"); int math=rs.getInt("math"); int english=rs.getInt("english"); if(number=k) boo=false; show.setText(null); sho

20、w.append("學(xué)號(hào):"+number+" 姓名:"+name+" 出生:"+date+" 數(shù)學(xué) "+math+" 英語(yǔ) "+english); show.append("n"); con.close(); if(boo) JOptionPane.showMessageDialog(this, "你輸入的學(xué)號(hào)不存在"); catch(SQLException eee) System.out.println(eee); 第五部分刪除:import jav

21、a.awt.*;import java.awt.event.*;import java.sql.*;import javax.swing.JOptionPane;public class shanchu extends Frame implements TextListener,ActionListenerButton xunzhao;TextField input;TextArea show;String s;int k,s1,j;Connection con; Statement sql; int sum=0; ResultSet rs;shanchu()Panel p=new Panel

22、();xunzhao= new Button("刪除");input= new TextField(10);show= new TextArea(6,43);p.add(new Label("輸入要?jiǎng)h除的" +"學(xué)號(hào)");p.add(input);p.add(xunzhao);xunzhao.addActionListener(this);show.addTextListener(this);show.setEditable(false);add(p,BorderLayout.NORTH);add(show,BorderLayout.

23、CENTER);setBounds(10,30,500,200);setVisible(true);validate();addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););public void actionPerformed(ActionEvent ee) boolean boo=true;s=input.getText();k=Integer.parseInt(s);String m,dir;try Class.forName("sun.jdbc.odb

24、c.JdbcOdbcDriver"); catch(ClassNotFoundException eee) System.out.println(""+eee); try con=DriverManager.getConnection("jdbc:odbc:sun","gxy","123"); sql=con.createStatement(); rs=sql.executeQuery("SELECT * FROM chengjibiao"); while(rs.next() int

25、number=rs.getInt(2); String name=rs.getString(3); String date=rs.getString("birthday"); int math=rs.getInt("math"); int english=rs.getInt("english"); if(number=k) show.setText("你刪除了:"); show.append("學(xué)號(hào):"+number+" 姓名:"+name+" 出生:"+

26、date+" 數(shù)學(xué) "+math+" 英語(yǔ) "+english); show.append("n"); m="DELETE FROM chengjibiao WHERE number="+k+"" sql.executeUpdate(m); con.close(); catch(SQLException e) System.out.println(e); 第六部分修改:import java.awt.*;import java.awt.event.*;import java.sql.*;impo

27、rt javax.swing.JOptionPane;public class xiugai extends Frame implements TextListener,ActionListenerButton charu;TextField input1,input2,input3,input4,input5,input6;TextArea show;Panel p1,p2;int k,s1,j;Connection con; Statement sql; int sum=0; ResultSet rs;xiugai() p1=new Panel(); p2=new Panel();char

28、u= new Button("修改");input1= new TextField(10);input2= new TextField(10);input3= new TextField(10);input4= new TextField(10);input5= new TextField(10);input6= new TextField(10);show= new TextArea(6,43);p1.add(new Label("請(qǐng)輸入要修改的學(xué)號(hào)");p1.add(new Label("number");p1.add(input

29、1);p2.add(new Label("請(qǐng)輸入修改的數(shù)據(jù)");p2.add(new Label("name");p2.add(input2);p2.add(new Label("date");p2.add(input3);p2.add(new Label("math");p2.add(input4);p2.add(new Label("english");p2.add(input5);p2.add(charu);charu.addActionListener(this);show.addTex

30、tListener(this);show.setEditable(false);add(p1,BorderLayout.NORTH);add(p2,BorderLayout.CENTER);setBounds(10,30,1200,200);setVisible(true);validate();addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););public void actionPerformed(ActionEvent ee) boolean boo=true;S

31、tring s0,s1,s2,s3,s4,s5,insert1,recode,name,date;int m0,m1,m2,m3,number,math,english;s1=input1.getText();m1=Integer.parseInt(s1);number=m1;s4=input4.getText();m2=Integer.parseInt(s4);math=m2;s5=input5.getText();m3=Integer.parseInt(s5);english=m3;try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver&q

32、uot;); catch(ClassNotFoundException eee) System.out.println(""+eee); try con=DriverManager.getConnection("jdbc:odbc:sun","gxy","123"); sql=con.createStatement();recode="("+m0+","+number+","+"'"+name+"'"

33、+","+"'"+date+"'"+","+math+","+english+")" insert1="UPDATE chengjibiao SET math="+math+",english="+english+" WHERE number="+number+"" sql.executeUpdate(insert1); catch(SQLException e) System.o

34、ut.println(e); 第七部分添加:import java.awt.*;import java.awt.event.*;import java.sql.*;import javax.swing.JOptionPane;public class charu extends Frame implements TextListener,ActionListenerButton charu;TextField input1,input2,input3,input4,input5,input6;TextArea show;int k,s1,j;Connection con; Statement

35、sql; int sum=0; ResultSet rs;charu()Panel p=new Panel();charu= new Button("插入");input1= new TextField(10);input2= new TextField(10);input3= new TextField(10);input4= new TextField(10);input5= new TextField(10);input6= new TextField(10);show= new TextArea(6,43);p.add(new Label("請(qǐng)輸入要插入的

36、數(shù)據(jù)");p.add(new Label("ID");p.add(input6);p.add(new Label("number");p.add(input1);p.add(new Label("name");p.add(input2);p.add(new Label("date");p.add(input3);p.add(new Label("math");p.add(input4);p.add(new Label("english");p.add(input5)

37、;p.add(charu);charu.addActionListener(this);show.addTextListener(this);show.setEditable(false);add(p,BorderLayout.NORTH);add(show,BorderLayout.CENTER);setBounds(10,30,1200,200);setVisible(true);validate();addWindowListener(new WindowAdapter()public void windowClosing(WindowEvent e)dispose(););public void actionPerformed(ActionEvent ee) boolean boo=true;String s0,s1,s2,s3,s4,s5,insert1,recode,name,date;int m0,m1,m2,m3,number,math,english;s0=input5.getText();m0=Integer.parseInt(s0);s1=input1.getText();m1=Integer.parseInt(s1

溫馨提示

  • 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)論