JAVA設(shè)計(jì)的學(xué)生管理系統(tǒng)源代碼_第1頁(yè)
JAVA設(shè)計(jì)的學(xué)生管理系統(tǒng)源代碼_第2頁(yè)
JAVA設(shè)計(jì)的學(xué)生管理系統(tǒng)源代碼_第3頁(yè)
JAVA設(shè)計(jì)的學(xué)生管理系統(tǒng)源代碼_第4頁(yè)
JAVA設(shè)計(jì)的學(xué)生管理系統(tǒng)源代碼_第5頁(yè)
已閱讀5頁(yè),還剩35頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、/Student_Management_System.java/JHelpTextPanel.javaimport java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.event.*;import java.io.*;/定義幫助文檔類(lèi)class JHelpTextPanel extends JPanelFont newSmallTitleFont=new Font(楷體,Font.BOLD,12);JTextArea HelpText=new JTextArea();JHelpTextPanel(

2、) setLayout(null); setBackground(Color.orange); HelpText.setBackground(Color.orange); HelpText.setForeground(Color.red); HelpText.setFont(newSmallTitleFont); HelpText.setBounds(0,0,600,600); add(HelpText);/Student_InforPanel .javaimport java.awt.*;import java.awt.event.*;import javax.swing.*;import

3、javax.swing.event.*;import java.io.*;class Student_InforPanel extends JPanel implements ActionListener/四種常用字體的定義Font newTitleFont=new Font(楷體,Font.BOLD,40);Font newSmallTitleFont=new Font(楷體,Font.BOLD,25);Font newCommonFont=new Font(宋體,Font.BOLD,20);Font newSubMenuFont=new Font(宋體,Font.BOLD,15);Font

4、 NewSubMenuFont=new Font(宋體,Font.BOLD,10);/性別數(shù)組定義String os= 男 , 女 ; /定義確認(rèn)對(duì)話框圖標(biāo)ImageIcon thinker=new ImageIcon(ICON/thinker.gif); /定義學(xué)生信息管理系統(tǒng)面板菜單控件JLabel StudentSno_Clue=new JLabel(學(xué)號(hào):);JLabel StudentName_Clue=new JLabel(姓名:);JLabel StudentSex_Clue=new JLabel(性別:);JLabel StudentAge_Clue=new JLabel(年齡

5、:);JLabel StudentClass_Clue=new JLabel(班級(jí):);JLabel StudentDept_Clue=new JLabel(系別:);JTextField StudentSno_Input=new JTextField();JTextField StudentName_Input=new JTextField();ComboBoxModel Othermode=new OtherAModel();JComboBox StudentSex_Input=new JComboBox(Othermode);JTextField StudentAge_Input=new

6、 JTextField();JTextField StudentClass_Input=new JTextField();JTextField StudentDept_Input=new JTextField();JTextArea QueryInforShow=new JTextArea(); JLabel QueryClue=new JLabel(以下是你要查詢(xún)的學(xué)生信息:);JButton Add_StudentInformation=new JButton(增加學(xué)生信息);JButton Del_StudentInformation=new JButton(刪除學(xué)生信息);JButto

7、n Query_StudentInformation=new JButton(查詢(xún)學(xué)生信息); JButton Modify_StudentInformation=new JButton(修改學(xué)生信息); /定義變量 int ValidAge; String SnoOrigin; Student_InforPanel() setBackground(Color.orange);QueryInforShow.setBackground(Color.orange);setLayout(null);StudentSno_Clue.setBounds(270,120,80,30);StudentSno

8、_Clue.setFont(newCommonFont);StudentSno_Input.setBounds(350,120,120,30);StudentName_Clue.setBounds(270,170,80,30);StudentName_Clue.setFont(newCommonFont);StudentName_Input.setBounds(350,170,120,30);StudentSex_Clue.setBounds(270,220,80,30);StudentSex_Clue.setFont(newCommonFont);StudentSex_Input.setBo

9、unds(350,220,120,30);StudentAge_Clue.setBounds(270,270,80,30);StudentAge_Clue.setFont(newCommonFont);StudentAge_Input.setBounds(350,270,120,30);StudentClass_Clue.setBounds(270,320,80,30);StudentClass_Clue.setFont(newCommonFont);StudentClass_Input.setBounds(350,320,120,30);StudentDept_Clue.setBounds(

10、270,370,80,30);StudentDept_Clue.setFont(newCommonFont);StudentDept_Input.setBounds(350,370,120,30);Query_StudentInformation.setBounds(80,120,130,30);Query_StudentInformation.setFont(newSubMenuFont);Query_StudentInformation.addActionListener(this);QueryClue.setBounds(80,180,300,50);QueryClue.setFont(

11、newSubMenuFont); QueryInforShow.setBounds(80,220,530,100);QueryInforShow.setFont(newSubMenuFont);Del_StudentInformation.setBounds(80,120,130,30);Del_StudentInformation.setFont(newSubMenuFont);Del_StudentInformation.addActionListener(this);Add_StudentInformation.setBounds(80,170,130,30);Add_StudentIn

12、formation.setFont(newSubMenuFont);Add_StudentInformation.addActionListener(this);Modify_StudentInformation.setBounds(80,220,130,30);Modify_StudentInformation.setBounds(80,220,130,30);Modify_StudentInformation.setFont(newSubMenuFont);Modify_StudentInformation.addActionListener(this);add(StudentSno_Cl

13、ue);add(StudentSno_Input);add(StudentName_Clue);add(StudentName_Input);add(StudentSex_Clue);add(StudentSex_Input);add(StudentAge_Clue);add(StudentAge_Input); add(StudentClass_Clue);add(StudentClass_Input);add(StudentDept_Clue);add(StudentDept_Input);add(QueryClue);add(QueryInforShow);add(Add_Student

14、Information);add(Del_StudentInformation);add(Query_StudentInformation); add(Modify_StudentInformation);public void actionPerformed(ActionEvent e) if(e.getSource()=Add_StudentInformation) if(IsValidAge(StudentAge_Input.getText() String *=(String)StudentSex_Input.getSelectedItem(); MainMenu.myDatabase

15、.Add_Database_Information(StudentSno_Input.getText(), StudentName_Input.getText(),*,ValidAge,StudentClass_Input.getText(),StudentDept_Input.getText(); emptyInput(); if(e.getSource()=Del_StudentInformation) QueryInforShow.setText(); if(MainMenu.myDatabase.Query_Database_Information(StudentSno_Input.g

16、etText() QueryInforShow.setText(DataBaseControl.temptInformation); int result=JOptionPane.showConfirmDialog(null,你確定要?jiǎng)h除該生信息嗎?,Confirm Message,JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE,thinker); if(result=JOptionPane.YES_OPTION) if(MainMenu.myDatabase.Del_Database_Information(StudentSno_

17、Input.getText() JOptionPane.showMessageDialog(null,刪除操作成功!,Happy Message,JOptionPane.PLAIN_MESSAGE); else JOptionPane.showMessageDialog(null,數(shù)據(jù)庫(kù)操作出現(xiàn)異常,刪除操作失敗!,Error Message,JOptionPane.ERROR_MESSAGE); else QueryInforShow.setText(對(duì)不起,沒(méi)有找到你要?jiǎng)h除的學(xué)生信息.); if(e.getSource()=Query_StudentInformation) QueryIn

18、forShow.setText(); if(MainMenu.myDatabase.Query_Database_Information(StudentSno_Input.getText() QueryInforShow.setText(DataBaseControl.temptInformation); else QueryInforShow.setText(對(duì)不起,沒(méi)有你想要查詢(xún)的學(xué)生信息); if(e.getSource()=Modify_StudentInformation) if(IsValidAge(StudentAge_Input.getText() MainMenu.myDat

19、abase.Modify_Database_Information(SnoOrigin,StudentSno_Input.getText(), StudentName_Input.getText(),ValidAge,StudentClass_Input.getText(),StudentDept_Input.getText(); public boolean IsValidAge(String StringAge) try ValidAge=Integer.parseInt(StringAge);catch(NumberFormatException e) e.printStackTrace

20、(); return false;if(ValidAge0) return true;else JOptionPane.showMessageDialog(null,你輸入的年齡不合實(shí)際情況n請(qǐng)重新輸入!,WARNING MESSAGE, JOptionPane.WARNING_MESSAGE); return false; class OtherAModel extends DefaultComboBoxModel OtherAModel() for(int i=0;i100|ValidScore0) JOptionPane.showMessageDialog(null,分?jǐn)?shù)只能在0100之

21、間的整數(shù)!,ERROR MESSAGE, JOptionPane.ERROR_MESSAGE); return false; return true;/只顯示學(xué)生成績(jī)面板中學(xué)號(hào)相關(guān)控件public void ScoreShowOnlySno() ScoreSno_Clue.setVisible(true); ScoreSno_Input.setVisible(true); ScoreSno_Input.setText(); ScoreShowClue.setVisible(true); ScoreShow.setVisible(true); ScoreEnglish_Clue.setVisib

22、le(false); ScoreEnglish_Input.setVisible(false); ScoreEnglish_Input.setText(); ScoreSeniorMath_Clue.setVisible(false); ScoreSeniorMath_Input.setVisible(false); ScoreSeniorMath_Input.setText(); ScoreC_Clue.setVisible(false); ScoreC_Input.setVisible(false); ScoreC_Input.setText(); ScoreVC_Clue.setVisi

23、ble(false); ScoreVC_Input.setVisible(false); ScoreVC_Input.setText(); ScoreJAVA_Clue.setVisible(false); ScoreJAVA_Input.setVisible(false); ScoreJAVA_Input.setText(); public void emptyInput()/清空成績(jī)輸入控件 ScoreSno_Input.setText(); ScoreEnglish_Input.setText(); ScoreSeniorMath_Input.setText(); ScoreC_Inpu

24、t.setText(); ScoreVC_Input.setText(); ScoreJAVA_Input.setText();/顯示學(xué)生成績(jī)面板中所有控件public void ScoreShowWhole() ScoreSno_Clue.setVisible(true); ScoreSno_Input.setVisible(true); ScoreShowClue.setVisible(false); ScoreShow.setVisible(false); ScoreEnglish_Clue.setVisible(true); ScoreEnglish_Input.setVisible(

25、true); ScoreSeniorMath_Clue.setVisible(true); ScoreSeniorMath_Input.setVisible(true); ScoreC_Clue.setVisible(true); ScoreC_Input.setVisible(true); ScoreVC_Clue.setVisible(true); ScoreVC_Input.setVisible(true); ScoreJAVA_Clue.setVisible(true); ScoreJAVA_Input.setVisible(true);/DataBaseControl.javaimp

26、ort java.awt.*;import javax.swing.*;import java.io.*;import java.sql.*;import java.awt.event.*;import java.util.*;/數(shù)據(jù)庫(kù)操作class DataBaseControl/private String s=; /登錄用戶(hù)信息 String UserRealName;String UserSex;int UserAge;String UserClass;String UserDept;/類(lèi)中公有變量類(lèi)型變量String LoginName=;String PW=;int Rank; f

27、inal int MaxNum=20; String Student_Information=new StringMaxNum; String Student_Score=new StringMaxNum; String Database_Score=學(xué)號(hào),英語(yǔ),高數(shù),C,VC,JAVA;String Database_Information=學(xué)號(hào),姓名,性別,年齡,班級(jí),系別;int NowScoreNum;int NowInformationNum; static String temptInformation=;private Connection con1;private Statement st1;String str;public void init(String UserName,String PassWord,int i) LoginName=UserName; PW=PassWord; Rank=i; public boolean ConnectDataBase()/連接數(shù)據(jù)源try Class.forName(sun.jdbc.odbc.JdbcOdbcDriver);catch(ClassNotFoundException e) System.out.println(Driver not found!); r

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 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ì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論