




已閱讀5頁(yè),還剩13頁(yè)未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
Java程序設(shè)計(jì)系 專 業(yè)班 級(jí)學(xué) 號(hào) 15號(hào)姓 名 劉振基題 目 學(xué)生成績(jī)管理系統(tǒng)任課教師 彭杰一:要求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 public 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 l1,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(學(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.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.add(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.addActionListener(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);setBounds(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);dispose();elseSystem.out.print(nishurucuowu);第三部分選擇操作: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 l1,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(學(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.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.add(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.addActionListener(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);setBounds(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);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;Connection 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(false);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(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 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); show.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 java.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();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.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.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 chengjibiao); while(rs.next() int 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+ 出生:+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.*;import 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();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);p1.add(new Label(請(qǐng)輸入要修改的學(xué)號(hào));p1.add(new Label(number);p1.add(input1);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.addTextListener(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;String 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); catch(ClassNotFoundException eee) System.out.println(+eee); try con=DriverManager.getConnection(jdbc:odbc:sun,gxy,123); sql=con.createStatement();recode=(+m0+,+number+,+name+,+date+,+math+,+english+); insert1=UPDATE chengjibiao SET math=+math+,english=+english+ WHERE number=+number+; sql.executeUpdate(insert1); catch(SQLException e) System.out.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 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)輸入要插入的數(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);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,s
溫馨提示
- 1. 本站所有資源如無(wú)特殊說明,都需要本地電腦安裝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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年證券從業(yè)資格證考試復(fù)習(xí)準(zhǔn)備與知識(shí)整合試題及答案
- 規(guī)范體電子警察系統(tǒng)技術(shù)投標(biāo)文件
- 行政管理師考試發(fā)展方向展望及試題及答案
- 2025年銀行從業(yè)資格考試真題研究試題及答案
- 廣東、上??茖W(xué)推理系統(tǒng)課講義-物理部分
- 2025年證券從業(yè)資格證考生須知試題及答案
- 尋找靈感2025年證券從業(yè)考試試題及答案
- 2025年證券從業(yè)資格證知識(shí)框架試題及答案
- 技能 課題 申報(bào)書
- 證券從業(yè)資格證的預(yù)測(cè)試題及答案
- 食品小攤販備案卡(樣式)及說明
- 針刀操作安全區(qū)帶
- THBFIA 0004-2020 紅棗制品標(biāo)準(zhǔn)
- GB/T 6072.1-2000往復(fù)式內(nèi)燃機(jī)性能第1部分:標(biāo)準(zhǔn)基準(zhǔn)狀況,功率、燃料消耗和機(jī)油消耗的標(biāo)定及試驗(yàn)方法
- 蘇教版科學(xué)(2017)六年級(jí)下冊(cè)教學(xué)計(jì)劃及教學(xué)進(jìn)度表
- 測(cè)量小燈泡的功率實(shí)驗(yàn)報(bào)告單
- 圖書館建筑設(shè)計(jì)規(guī)范講解課件
- 四川省教師資格認(rèn)定體檢表
- 培養(yǎng)中班幼兒正確使用筷子的研究的結(jié)題報(bào)告
- 湘教版七年級(jí)上冊(cè)等高線地形圖
- 車間改造合同范文
評(píng)論
0/150
提交評(píng)論