学生学籍管理系统含java源代码.docx

上传人:b****6 文档编号:8420007 上传时间:2023-01-31 格式:DOCX 页数:27 大小:20.93KB
下载 相关 举报
学生学籍管理系统含java源代码.docx_第1页
第1页 / 共27页
学生学籍管理系统含java源代码.docx_第2页
第2页 / 共27页
学生学籍管理系统含java源代码.docx_第3页
第3页 / 共27页
学生学籍管理系统含java源代码.docx_第4页
第4页 / 共27页
学生学籍管理系统含java源代码.docx_第5页
第5页 / 共27页
点击查看更多>>
下载资源
资源描述

学生学籍管理系统含java源代码.docx

《学生学籍管理系统含java源代码.docx》由会员分享,可在线阅读,更多相关《学生学籍管理系统含java源代码.docx(27页珍藏版)》请在冰豆网上搜索。

学生学籍管理系统含java源代码.docx

学生学籍管理系统含java源代码

学生学籍管理详细设计

学号:

____________

姓名:

____________

班级:

____________

1、设计题目:

学生学籍管理

二:

设计内容:

设计GUI学生学籍管理界面,用户可以加入学生信息,并对基本信息进行修改,添加,查询,删除。

三:

设计要求:

进行简单的学生信息管理。

四:

总体设计

(1)登陆界面的设计

(2)主窗体的设计

(3)添加学生信息窗体

(4)查询学生信息窗体

(5)修改学生信息窗体

(6)删除学生信息窗体

(7)事件响应的处理

五:

具体设计

(1)程序结构的说明:

A.入口程序:

student.java;

B.登陆界面程序:

mainframe.java;

C.主窗体程序:

interfac.java;

D.添加信息窗口程序:

tj.java;

E.修改信息窗口程序:

xg.java;

F.查询信息窗口程序:

cx.java;

G.删除信息窗口程序:

sc.java;

H.程序数据连接:

DatabaseConn.java;

(2)程序代码及分析说明

A.程序源代码(已提交)

“进入系统”,然后登陆界面消失;出现要操作的界面(屏幕左上角)。

“添加信息”按钮,将信息加入xinxi表中。

“修改信息”按钮(如果数据库中不存在此学号,则弹出对话框“无此学生信息”),若有则修改。

“删除信息”按钮,弹出确认删除对话框,即可删除该生信息。

“信息查询”按钮,在相应的文本区里显示查询的信息。

H:

源代码

//student.java:

程序的入口。

初始化界面,使主界面位于屏幕中间,且用户不能改变大小

//功能:

完成程序的执行顺序

importjava.awt.*;

importjava.sql.*;

//importscreen

publicclassstudent

{

booleanpackFrame=false;

//JFrameframe=newJFrame();

publicstudent()

{

mainframeframe=newmainframe();

if(packFrame)

{

frame.pack();

}

else

{

frame.validate();

}

DimensionscreenSize=Toolkit.getDefaultToolkit().getScreenSize();

DimensionframeSize=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);

}

publicstaticvoidmain(String[]args)

{

try{

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

}

catch(Exceptione)

{

e.printStackTrace();

}

newstudent();

}

}

//数据库连接

//packagesql.database;

importjava.sql.*;

publicclassDatabaseConn

{

privatestaticStringuser="";

privatestaticStringpassword="";

privateConnectionconn=null;

privateStatementstmt=null;

privateResultSetrs=null;

static

{

}

catch(ClassNotFoundExceptione){}

}

//创建数据库连接对象

publicConnectiongetConnection()

{

try{

conn=DriverManager.getConnection("jdbc:

odbc:

stu",user,password);

returnconn;

}catch(SQLExceptione)

{

returnnull;

}

}

publicStatementcreateStat()

{

try{

conn=getConnection();

stmt=conn.createStatement();

returnstmt;

}catch(SQLExceptione)

{returnnull;}

}

publicResultSetgetRs(Stringsql)

{

try{

conn=getConnection();//...

stmt=createStat();

rs=stmt.executeQuery(sql);

returnrs;

}catch(SQLExceptione)

{

returnnull;

}

}

publicvoidclose()

{

try{

if(rs!

=null)

rs.close();

if(stmt!

=null)

stmt.close();

if(conn!

=null)

conn.close();

}catch(SQLExceptionex)

{

ex.printStackTrace();

}

}

}

//mainframe.java

importjava.awt.*;

importjavax.swing.*;

importjava.sql.*;

publicclassmainframeextendsJFrameimplementsActionListener

{

staticmainframes;

staticJPanelpan=newJPanel();

staticJLabellabel1=newJLabel("用户");

staticJLabellabel2=newJLabel("密码");

staticJTextFieldtextField1=newJTextField();

staticJPasswordFieldpassword=newJPasswordField();

staticJButtonbutton1=newJButton("进入系统");

staticJRadioButtonradioButton1=newJRadioButton("管理员",true);//“管理员”初始状态被选中

staticJRadioButtonradioButton2=newJRadioButton("学生");

staticJRadioButtonradioButton3=newJRadioButton("教师");

ButtonGroupbuttonGroup=newButtonGroup();

publicmainframe()

{

JLabellabel=newJLabel(newImageIcon("图片44.jpg"));

label.setSize(400,400);

pan.add(label);

pan.setLayout(null);

pan.setSize(400,400);

this.setTitle("学籍管理系统");

this.setSize(400,400);

this.setLayout(null);

label1.setBounds(100,25,49,20);

textField1.setBounds(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);

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.setVisible(true);

}

publicstaticvoidmain(String[]args)

{

newmainframe();

}

publicvoidactionPerformed(ActionEvente)

{

if(radioButton1.isSelected())//管理员

{

if(textField1.getText().equals("syc")&&password.getText().equals("123")){

interfacb=newinterfac();

this.dispose();

//JOptionPane.showMessageDialog(null,"登陆成功");

}elseif("".equals(textField1.getText())||"".equals(password.getText())){

JOptionPane.showMessageDialog(null,"用户名或密码不能为空");

}else{

JOptionPane.showMessageDialog(null,"用户名或密码输入有误");

}

}

if(radioButton2.isSelected())//学生

{

try{

}

catch(ClassNotFoundExceptionce)

{

JOptionPane.showMessageDialog(s,ce.getMessage());

}

try

{

Connectioncon=DriverManager.getConnection("jdbc:

odbc:

stu","sa","");

Statementstmt=con.createStatement();

ResultSetrs=stmt.executeQuery("select*frompasswordwhere用户名='"+textField1.getText()+"'and密码='"+password.getText()+"'");

if(textField1.getText().equals("")||password.getText().equals(""))

{

JOptionPane.showMessageDialog(this,"用户名或密码不可为空!

");

}

elseif(rs.next())

{newinterfac();}

else

{JOptionPane.showMessageDialog(this,"您的输入有误");}

//stmt.close();

}

catch(SQLExceptionse)

{

JOptionPane.showMessageDialog(s,se.getMessage());

}

}

}

}

//interface.java

importjava.awt.*;

importjavax.swing.*;

publicclassinterfacextendsJFrameimplementsActionListener

{

staticJMenuBarjMenuBar=newJMenuBar();//菜单条

staticJMenujMenuFile=newJMenu("文件");//菜单项

staticJMenujMenuExit=newJMenu("退出");

staticJMenuItemjMenuItem1=newJMenuItem("添加信息");//菜单子项

staticJMenuItemjMenuItem2=newJMenuItem("修改信息");

staticJMenuItemjMenuItem3=newJMenuItem("信息查询");

staticJMenuItemjMenuItem4=newJMenuItem("删除信息");

staticJLabellabel3=newJLabel("请选择操作项");

staticJLabellabel4=newJLabel("学籍管理系统");

staticJButtonbutton2=newJButton("添加信息");

staticJButtonbutton3=newJButton("修改信息");

staticJButtonbutton4=newJButton("信息查询");

staticJButtonbutton5=newJButton("删除信息");

publicinterfac()

{

this.setTitle("学籍管理系统");

this.setLayout(null);

this.setSize(400,400);

label3.setBounds(158,92,98,33);

label3.setFont(newFont("Dialog",Font.PLAIN,15));

label4.setFont(newFont("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.add(button4);

this.add(button5);

this.add(label3);

this.add(label4);

setJMenuBar(jMenuBar);

jMenuFile.add(jMenuItem1);//”文件“菜单项中加入子菜单

jMenuFile.add(jMenuItem2);

jMenuFile.add(jMenuItem3);

jMenuFile.add(jMenuItem4);

jMenuBar.add(jMenuFile);//将菜单项加入菜单条

jMenuBar.add(jMenuExit);

button2.addActionListener(this);//本窗口向按钮事件源注册

button3.addActionListener(this);

button4.addActionListener(this);

button5.addActionListener(this);

jMenuItem1.addActionListener(this);//本窗口菜单子项注册

jMenuItem2.addActionListener(this);

jMenuItem3.addActionListener(this);

jMenuItem4.addActionListener(this);

jMenuExit.addActionListener(this);

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

this.setVisible(true);

}

publicstaticvoidmain(String[]args)

{

interfaca=newinterfac();

}

publicvoidactionPerformed(ActionEvente)//按钮事件的处理

{

if(e.getSource()==jMenuExit)

{

System.exit(0);

}

elseif(e.getSource()==jMenuItem1||e.getSource()==button2)

{

try{

tja=newtj();

}

catch(Exceptionee){}

}

elseif(e.getSource()==jMenuItem2||e.getSource()==button3)

{

try{

xga=newxg();

}catch(Exceptioned){}

}

elseif(e.getSource()==jMenuItem3||e.getSource()==button4)

{

try{

cxa=newcx();}

catch(Exceptionec){}

}

elseif(e.getSource()==jMenuItem4||e.getSource()==button5)

{

try{

sca=newsc();

}catch(Exceptiones){}

}

}

}

//tj.java添加界面

importjavax.swing.*;

importjava.awt.*;

importjava.sql.*;

publicclasstjextendsJFrameimplementsActionListener

{

statictjs;

staticJLabellabel1=newJLabel("学号:

");

staticJTextFieldtextField1=newJTextField("");

staticJLabellabel2=newJLabel("姓名:

");

staticJTextFieldtextField2=newJTextField("");

staticJLabellabel3=newJLabel("性别:

");

staticJTextFieldtextField7=newJTextField("");

staticJLabellabel4=newJLabel("出生日期:

");

staticJTextFieldtextField3=newJTextField("");

staticJLabellabel5=newJLabel("政治面貌:

");

staticJTextFieldtextField8=newJTextField("");

staticJLabellabel6=newJLabel("籍贯");

staticJTextFieldtextField4=newJTextField("");

staticJLabellabel7=newJLabel("系别:

");

staticJTextFieldtextField9=newJTextField("");

staticJLabellabel8=newJLabel("专业:

");

staticJTextFieldtextField5=newJTextField("");

staticJButtonbutton1=newJButton("增加");

publictj()

{

this.setTitle("增加学生信息");

this.setLayout(null);

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.setBounds(86,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 经济市场

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1