NetBeans實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)源碼1_第1頁
NetBeans實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)源碼1_第2頁
NetBeans實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)源碼1_第3頁
NetBeans實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)源碼1_第4頁
NetBeans實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)源碼1_第5頁
已閱讀5頁,還剩65頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

Developedby

GroupName:Water

StarReg.No:R3P3000005

SylviaReg.No:R3P3000045

JuneReg.No:R3P3000050

NUT

PROJECTION

StudentInformationManagementSystern

StudentManagementSystemSoftware

BatchCode:

StartDate:08/03/2019

NameoftheCoordinator:ShahnawazAhmadKhan

NameoftheDeveloper:Ms.Water

EnglishName:Water

Name(Chinese&Ponyin):水(water)

EndDate:14/03/2019

DateofSubmission:18/03/2019

NUT

CERTIFICATE

Thisistocertifythatthisreport,titledStudent

InformationManagementSystem”,embodiestheoriginal

workdonebyPeterInpartialfulfillmentofhiscourse

requirementatNUT.

Coordinator:ShahnawazAhmadKhan

AssociateCoordinator:

Acknowledgement

IwouldliketothankourFacultyMr.ShahnawazandChinese

associateFacultyMs.LiFanfanforalltheirguidanceand

supportduringtheentirephaseofthisprojectdevelopment

withoutwhichtheprojectwouldnothavebeencompleted.

SystemAnalysis

SystemSummary:Itisconvenientfortheuserstomanage

studentinformation,forexample:add,delete,updateand

overviewstudentinformation.

BusinessRules:

1,createdatabase,tablesandconstraints.

2,interfacedesign

3,implementthesourcecode

4,debugandtest

DataQuery:

createdatabaseSIMS

useSIMS

createtableuseinfo

(uidintprimarykeyidentity(101,1),

unamenchar20notnull,

upasswordnchar(10)default'00000',

urealnamenchar(20),

umobilnchar(15)

)

createtablestudentinfor

(sidintprimarykeyidentity(10001,1),

snamenchar20not.nul1,

InterfaceDesignforStudentInformationManager

Asthedevelopmentofthecomputer,moreandmore

managementdependonthecomputer.

Forthisreason,wegroupWaterdesignastudent

informationmanagementforthestudentinformation

managementsystem.Itisconvenientforthemanagerto

overview,add,update,deletestudentinformation.

AddUserlnformAtion

nformation

Passvord

1-Idrasstcrd

Re&lHse?MIL

T?v?as:?crd

Mobihtdit150663929?

OKQuit

OK

?ermandgefnertoverviewhelp

WelcomeToThsSystem!

,jT:CaU

S?1K<byID

jjA“1dM的7。

SlisgtbUrsbirthnohl*ilstet..SBtjar

10015加150PM..a[laf?r?...|l<fo..

】001:云一150W7..lafir*Mtao..

Update$tudentlnformdt?onl|^^/o!口

2,AddStudentIrformationT0以

m

110015

JxmtJ“k

Birth4?yG*n<?rBirthday'

?■通p1969*-12▼?2S▼觸?OF1S65▼-6▼-6▼

JktdMy.Major:AcadeaiyRaj?r:

<dsjkfhjasdkfatInf?r?*ti?nn?ta?rlnM

MobilMobil[nil

Configuration

Hardware:Intel(R)Pentium(R)DualE21802.1GHz

1.20GHz3.00GBRAM

250GB7200RPMHardDisk

10/100NIC

OpticalMouse

Keyboard

17z,ColorMonitor

IndividualProjectSchedule

SrNActivityPlanneddateActualDateRemarks

0Descriptionof

Completion

1Create09/03/201909/03/2019No

DatabaseProblem

2Interface09/03/201909/03/2019No

DesignProblem

3Interface11/03/201911/03/2019No

Implementatioproblem

n

4Function13/03/201911/03/2019No

Implementatioproblem

n

5Debugging13/03/201913/03/2019Many

Problems

hadbeen

solved

6

7

SourceCocle

8

9

10

11

//loginGUIandthemainfunction

//StudentMain.j£va

packagestudentinformationmanagemcntsystcm;

importjava.awt.

importjavax.swing.*;

importjava.awt.event.

importjava.sql.

importjavax.swing.UIManager;

publicclassStudentMainextendsJFrameimplements

ActionListener

JLabelLtitie,Lname,Lpassword;

JButtonBlogin,Bexit,Lregister;

JTextFieldTFname;

JPasswordFieldTFpassword;

GridBagLayoutgbl;

GridBagConstraintsgbc;

GridLayoutgl;

Fontfl,f2,f3;

JPanelpl,p2;

Connectioncon;

PreparedStatementstat;

Statementstmt;

ResultSetrs;

publicStringname;

publicStudentMain(booleanflag)

//booleanf=f

super(^StudentlnformationManagemcntSystcm7");

this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE

);

fl=newFont("宋體〃,1,25);

f2=newFont(〃宋體〃,1,20);

f3=newFont(〃宋體〃,1,18);

Ltitle=newJLabel("StudentInformationManageir.ent

System”,JLabel.CENTER);

Ltitle.setVerticalAlignment(JLabel.CENTER);

Ltitle.setForeground(Color,red);

Lname=newJLabel(〃UserName〃,JLabel.CENTER);

Lpassword=newJLabel(,zUserPasswordz,,JLabel.CENTER);

Lregister=newJButton("Register");

Ltitle.setFont(fl);

Lname.setFont(f2);

Lpassword.setFont(f2);

Lregister.setFont(f2);

TFname=newJTextField(15);

//TFname.setBounds(0,0,150,40);

TFname.setFont(f2);

TFpassword=newJPasswordFie1d(15);

TFpassword.setFont(f2);

TFpassword.setEchoChar(,*');

Blogin=newJButton(〃Login〃);

Blogin.setFont(f2);

Bexit=newJButton(〃Exit〃);

Bexit.setFont(f2);

pl=newJPanel();

p2=newJPanel0;

gbl=ncwGridBagLayout();

gbc=newGridBagConstraints():

gl=newGridLayout(3,1);

pl.setLayout(gbl);

gbc.fiH=GridBagConstraints.NONE;

gbc.insets二newInsets(O,0,11,10);

gbc.anchor=GridBagConstraints.CENTER;

gbc.gridwidth=l;

gbl.setConstraints(Lname,gbc);

pl.add(Lname);

gbc.gridwidth=GridBagConstraints.REMAINDER;

gbc.anchor=GridBagConstraints.LINESTART;

gbl.setConstraints(TFname,gbc);

pl.add(TFname);

gbc.gridwidth=l;

gbc.anchor=GridBagConstraints.CENTER;

gbl.setConstraints(Lpassword,gbc);

pl.add(Lpassword);

gbc.gridwidth=GridBagConstraints.REMAINDER;

gbc.anchor=GridBagConstraints.CENTER;

gbl.setConstraints(TFpassword,gbc);

pl.add(TFpassword);

p2.setLayout(now

FlowLayout(FlowLayout.CENTER,20,0));

p2.add(Blogin);

p2.add(Bexit);

p2.add(Lregister);

this.setLayout(gl);

this.add(Ltitle);

this.add(pl);

this,add(p2);

Blogin.addActionListener(this);

Bexit.addActionListener(this;;

Lregister.addActionListener(this);

DimensionscreenSize

Toolkit.getDefaultToolkit().getScreenSizeO;

setBounds((screenSize.width_365)/2,

(screenSize.height-449)/2,550,350):

this.setVisible(flag);

publicvoidEctionPerformed(ActionEventae)

if(ae.getActionCommand()二二〃Exit")

System,exit(0);

if(ae.getActionCommand()二二〃Login")

name=TFname.getText();

Stringpassword=TFpassword.getText();

if(name,equals(〃〃)|password,equals(〃〃))

JOptionPane.showMessageDialog(null,''UserNcime,UserPassword

isnotnull");

else{

try

Class.forName(z,sun.jdbc.odbc.JdbcOdbcDriver,z);

con=DriverManager.getConnection("jdbc:odbc:DataSource",〃”,〃

〃);

Statementstmt=con.createStatement();

ResultSetrs=stmt.executeQuery(''SELECT*

FROMuseinfo");

booleanisfind=false:

while(rs.next())

if(name,equals(rs.getString(2)))

isfind=true;

if(password,equals(rs.getString(3)))

this.disposeO;

nowFunction(name);

TFname.setText;

TFpassword.setText(〃〃);

else

JOptionPane.showMessageDialog(null,^Passwordisworng!");

break;

if(isfind==false)

JOptionPane.showMessageDialog(null,zzNot

ExsittheUser,PleaseRegister!〃);

con.close();

}catch(Exceptione)

System,out.printinC'Error

〃+e.getMessageO);

if(ae.getActionCommand()二二〃Register")

newAddUser();

publicstaticvoidmain(String[]args){

//TODOcodeapplicationlogichere

try

UIManager.setLookAndFeel(new

com.sun.java,swing,plaf.windows.WindowsLookAndFeel());

catch(Exceptione)

newStudentMain(true);

//FunctionGUI

//Function,java

packagestudentinfornicitionmanagementsystem;

importjavax.swing.*;

importjava.awt.

importjava.awt.event.*;

importjava.sql.

importjavax.swing,table.*;

importjava.util.

publicclassFunctionextendsJFrameimplementsActionListener

JMenufunmenul,funmenu2,funmenu3:

JMenuItem

menuitempwd,menulogout,menuexit,menuoverview;

JPanelfunpl1,funpl2,funpl3,funpl4,funpl5,funpl6;

JLabelfunlbl,funlb2;

JButton

funjbadd,funjbdelete,funjbupdate,funjboverview,funjbok,funj

bcancel;

JMenuBarfunmenubar;

JComboBoxfunjcbl;

JTextFieldfunjtf1,funjtf2;

Fontfunfl;

JScrollPanejsp;

JTablefunjtb;

JScrollPanefunjsp;

Connectioncon;

Statementstmt;

PreparedStatementstat;

ResultSetrs;

ResultSetMetaDatarsmd;

publicStringss;

Function(Stringstr)

super(/zStudentManagementSystenr);

this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE

);

ss=str;

setLayout(null);

funjsp=newJScroilPane();

funfl=newFont(〃Arial〃,F(xiàn)ont.BOLD|Font.ITALIC,20);

funjcbl=newJComboBox();

funjcbl.addltem(,zselectbyID");

funjcbl.addltem(,zselectbyname");

funjcbl.addActionListener(this);

funpl2=newJPanel();

funp12.setLayout(new

FlowLayout(FlowLayout.CENTER,0,3));

funpl3=newJPanel();

funpl3.setLayout(new

FlowLayout(FlowLayout.LEFT,20,3));

funpl4=newJPanel();

funpl4.setLayout(new

FlowLayout(FlowLayout.CENTER,20,3));

funpl5=newJPanel();

funpl5.setLayout(newGridLayout(4,1));

funpl6=newJPanel();

funpl6.setLayout(newFlowLayout());

funmcnubar=newJMenuBar();

funmenubar.setBounds(0,0,490,30);

funlbl=newJLabel(''WelcomeToTheSystem!

,z,JLabel.CENTER);

funlbl.setFont(funfl);

Objecttablesize[][]=newObject[20][8];

for(inti=0;i<20;i++)

for(intj=0;j<8;j++)

tablesize[i][j]=null;

String

columnLJ=isid,sname,sgender,sbirth,smobil,semil

,saccidemy,smajorJ;

funjtb=newJTable(tablesize,column);

funjtb.setShowGrid(true);

funjtfl=newJTextField(25);

funjtf1.addActionListener(this);

funjbadd=newJButton("Add");

funjbadd.addActionListener(this);

funjbdelete=newJButton("Delete");

funjbdelete.addActionListener(this);

funjboverview=newJButton("Overview");

funjboverview.addActionListener(this);

funjbupdate=newJButton("Update");

funjbupdate.addActionListener(this);

funjbok=newJButton("OK");

funjbok.addActionListener(this);

funjbcancel=newJButton("Cancel");

funjbcancel.addActionListener(this);

funmenul=newJMenu(,zusermanagement");

funmenu2=newJMenu(z,overview");

funmonu3=ncwJMenu(,zhelp");

menuoverview=newJMenuItem("checkmy

infomation”,JMenuItem.CENTER);

menuoverview.addActionListener(this);

menuitempwd=newJMenuItem("password

management/z,JMenuItem.CENTER);

menuitempwd.addActionListener(this);

funmenu1.add(menuoverview);

funmenul.add(menuitempwd);

menulogout=newJMenuItem("LogOutz/,JMenuItem.CENTER);

menulogout.addActionListener(this);

funmenul.add(menulogout);

menuexit=newJMenuItem(^Exit7",JMenuItem.CENTER);

menuexit.addActionListener(this);

funmenul.add(menuexit);

funmenubar,add(funmenul);

funmenubar,add(funmenu2);

funmenubar,add(funmenu3);

funpl2.add(funlbl);

funpl3.add(funjcbl);

funpl3.add(funjtf1);

funp13.add(funjbok);

funp13.add(funjbcancel);

funpl4.add(funjboverview);

funp14.add(funjbadd);

funpl4.add(funjbdelete);

funpl4.add(funjbupdate);

funpl5.add(funpl2);

funp15.add(funpl3);

funpl5.add(funpl4);

funpl5.setBounds(0,50,475,120);

funp16.add(newJScrollPane(funjtb));

funpl6.setBounds(10,165,455,500);

add(funmenubar);

add(funpl5);

add(funpl6);

this.setVisible(true);

DimensionscreenSize

Toolkit.getDefaultToolkit().getScreenSize();

setBounds((screenSize.width-450)/2,

(screenSize.height-550)/2,490,580);

publicvoidactionPerformed(ActionEventae)

//updatepassword

Strings=£e.getActionCommand();

TabieModelmdl=funjtb.getModel();

if(ae.getSource().equals(menuitempwd))

try(

UpdatePasswordup=newUpdatePassword();

up.TFuname.setText(ss);

}catch(Exceptione)

System,out.printin(z,Error:〃+e);

elseif(ae.getSource().equals(funjboverview))

try

Class.forNameC'sun.jdbc.odbc.JdbcOdbcDriver,z);

con=DriverManager.getConnection(/zjdbc:odbc:DataSource'7);

stmt=con.createStatement();

rs=stmt.executeQuery(,zselect*from

studentinfor,z);

StringrowsLJ={

while(rs.next())

for(inti=0;i<8;i++)

rows[i]=rs.getString(i+l);

mdl.setValueAt(rows[i],

rs.getRow()-l,i);

con.close();

funjtb.repaint();

catch(Exceptione)

System.out.printin("Error:〃+e);

elseif(ae.getSource().equals(menuoverview))

try

con=DriverManager.getConnection(,zjdbc:odbc:DataSource,z);

stmt=con.createStatement();

rs=stmt.executeQuery("select

uid,uname,urealname,umobilfromuseinfowhere

uname=+ss+);

rs.next();

Stringid=Integer.toSrring(rs.getlnt(1));

Stringname=rs.getString(2);

Stringrealname=rs.getString(3);

Stringmobil=rs.getString(4);

Userinformationui=newUserinformation(true);

ui.TFuid.setText(id);

ui.TFuname.setText(name);

ui.TFurealname.setText(realname);

ui.TFumobil.setText(mobil);

con.close();

}catch(Exceptione)

System.out.printin(z,Error:〃+e);

elseif(ae.getSource().equals(menulogout))

this,dispose();

newStudentMain(true);

elseif(ae.getSource().equals(menuexit))

System,exit(1);

elseif(ae.getSource()==funjbok)

if(funjtf1.getText().equals(〃〃))

JOptionPane.showMessageDialog(null,“Please

InputTheStudentIDorStudentName,,);

elseif(funjcbl.getSelectedltemO.equals("select

byIDO)

intsid=Integer.parselnt(funjtf1.getText());

try

con=DriverManager.getConnection(/zjdbc:odbc:DataSource'");

stmt=con.createStatement();

rs=stmt.executeQuery("select*from

studentinforwheresid=〃+sid);

String

rq/〃〃〃〃〃〃〃〃〃〃〃〃〃〃〃〃〕

rowsLJ=t

if(rs.next())

intid=rs.getlnt(1);

StringID=Integer.toString(id);

Stringname=rs.getString(2);

Stringgender=rs.getString(3);

Stringbirth=rs.getString(4);

Stringmobil=rs.getString(5);

Stringemail=rs.getString(6);

Stringacademy=rs.getString(7);

Stringmajor=rs.getString⑻;

StudentInformationsi=new

Studentinformation();

si.TFid.setText(ID);

si.TFname.setText(name);

si.TFsex.setText(gender);

si.TFbirthday.setText(birth);

si.TFmobil.setText(mobil);

si.TFemail.setText(email);

si.TFacademy.setText(academy);

si.TFmajor.setText(major);

else

JOptionPane.showMessagoDialog(null,

“CheckTheIDAgain!”);

con.close();

catch(Exceptione)

System,out.printin(''Error:,z+e);

elseif(funjcbl.getSelectedltemO.equals(''select

byname"))

try

con=DriverManager.getConnectionCjdbc:odbc:DataSource");

stmt=con.createStatement();

rs=stmt.executeQuery(z/select*from

studentinforwheresname=,z,+funjtf1.getText()+〃'〃);

StringrowsLJ={

rsmd=rs.getMetaDataO;

if(rs.next())

intid=rs.getlnt(1);

StringlD=Integer.toString(id);

Stringname=rs.getString⑵;

Stringgender=rs.getString⑶;

Stringbirth=rs.getString(4);

Stringmobil=rs.getString(5);

Stringomail=rs.getString(6);

Stringacademy=rs.getString(7);

Stringmajor=rs.getString(8);

StudentInformationsi=new

Studentinformation();

si.TFid.setText(ID);

si.TFname.setTexi(name);

si.TFsex.setText(gender);

si.TFbirthday.setText(birth);

si.TFmobil.setText(mobil);

si.TFemail.setText(email);

si.TFacademy.setText(academy);

si.TFmajor.setText(major);

else

JOptionPane.showMessageDialog(null,

“CheckTheNameAgain!”);

con.close();

funjtb.repaint();

funjtb.updatelll();

catch(Exceptione)

System,out.printin("Error:〃+e);

elseif(ae.getSource().equals(funjbcancel))

funjtf1.setText(null);

elseif(ae.getActionCommand()==z,Add,z)

newAddinformation();

elseif(ae.getActionCommcind()二二〃Delete")

try(

if(funjcbl.getSelectedltemO.equals(z,select

byID"))

if(funjtf1.getText().equals(〃”))

JOptionPane.showMessageDialog(null,"PleaseInputStudentlD!

〃);

else{

con=DriverManager.getConnection(,zjdbc:odbc:DataSource,/);

stmt=con.crcateStatement();

rs=stmt.executeQuery(z,select*from

studentinforwhere

sid=,,+lnteger.parselnt(funjtf1.getText()));

if(rs.next())

con.closeO;

con=DriverManager.getConnection(,zjdbc:odbc:DataSource,z);

stat=con.preparestatemont(z,dolets

fromstudentinforwheresid=?〃);

Stringsl=funjtfl.getText();

intn=Integer.parselnt(si);

stat,setlnt(1,n);

stat.executeUpdate();

JOptionPane.showMessageDialog(null,,zStudenthasbeen

Deleted!〃);

con.close();

else

JOptionPane.showMessageDialog(null,,zTheStufdentnotExist!

〃);

else

if(funjcbl.getSelectedltemO.equals(""selectbyname"))

if(funjtf1.getText().equals(〃"))

JOptionPane.showMessageDialog(null,''PleaseInput

StudentName!〃);

else{

con=DriverManager.gotConnection(zzjdbc:odbc:DataSource,z);

stmt=con.createSratement();

rs=stmt.executeQuery("'select*from

studentinforwheresname='〃+funjtfl.getText()+〃'〃);

if(rs.next())

con.closeO;

con=DriverManager.getConnection(,zjdbc:odbc:DataSource,/);

stat=con.prepareStatement("delete

fromstudentinforwheresname=?z,);

Stringsl=funjtfl.getTextO;

stat.setStringd,si);

stat,executellpdate();

JOptionPane.showMessageDialog(null,''Studenthasbeen

Deleted!〃);

con.close();

else

JOptionPane.showMessageDialog(null,,zTheStufdentnotExist!

〃);

}catch(Exceptione)

System,out.printin(z,Error:〃+e);

elseif(ae.getSource().equals(funjbupdate))

try

if(funjcbl.getSelectedltem().equals(''select

byID〃))

if(funjtfl.getText().equals(〃〃))

JOptionPane.showMessageDialog(null,/zPleaseInputStudentTD!

〃);

else

con=DriverManager.getConnection(z,jdbc:odbc:DataSourcez,);

stmt=con.createStatement();

rs=stmt.executeQuery(''select*from

studentinforwhere

sid=/,+Integer.parselnt(funjtfl.getText()));

if(rs.next())

Stringsss=funjtf1.getText();

intsd=Integer.parselnt(sss);

Updateinformationui=new

UpdateInformation();

con=DriverManager.gotConnection(zzjdbc:odbc:DataSource,z);

stmt=con.createStatement();

rs=stmt.executeQuery("'select*

fromstudentinforwheresid=〃+sd);

rs.next0;

Stringsr=rs.getString(l);

Stringsrl=rs.getString(2);

ui.TFid.setText(sr);

ui.TFname.setText(srl);

con.close();

else

JOptionPane.showMessageDialog(null,,zTheStufdentnotExist!

〃);

if(funjcbl.getSelectedTtemO.equals(''select

byname"))

if(funjtf1.getText().equals(〃"))

JOptionPane.showMessageDialog(null,''PleaseInput

StudentName!〃);

else

con=DriverManager.gotConnection(zzjdbc:odbc:DataSource,z);

stmt=con.createStatement();

rs=stmt.executeQuery(''select*from

studentinforwheresname='〃+funjtfl.getText()+〃'〃);

if(rs.next()j

Stringss=funjtfl.getTextO;

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論