完整版学生学籍管理系统含java源代码.docx
- 文档编号:1141489
- 上传时间:2022-10-17
- 格式:DOCX
- 页数:29
- 大小:81.63KB
完整版学生学籍管理系统含java源代码.docx
《完整版学生学籍管理系统含java源代码.docx》由会员分享,可在线阅读,更多相关《完整版学生学籍管理系统含java源代码.docx(29页珍藏版)》请在冰豆网上搜索。
完整版学生学籍管理系统含java源代码
学生学籍管理详细设计
学号:
姓名:
班级:
一、设计题目:
学生学籍管理
二:
设计内容:
设计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.程序源代码(已提交)
B.Student.java是程序的入口。
使登录窗口位于窗口中间,并且不可改变窗口
大小。
C.mainframe.java是程序的登陆窗体。
输入用户名和密码(用户名和密码在数
据库的password表中)点击“进入系统”,然后登陆界面消失;出现要操作的界
面(屏幕左上角)。
D.tj.java是添加信息界面。
添加基本信息后,点击“添加信息”按钮,将信息
加入xinxi表中。
E.xg.java是修改信息界面。
输入要修改的学号或姓名(两者数其一或全部输
入),并输入所有信息,点击“修改信息”按钮(如果数据库中不存在此学号,
则弹出对话框“无此学生信息”),若有则修改。
F.sc.java是删除信息界面。
输入要删除的学生的学号,点击“删除信息”按钮,
弹出确认删除对话框,即可删除该生信息。
G.cx.java是查询信息界面。
输入要查询的学生学号,点击“信息查询”按钮,
在相应的文本区里显示查询的信息。
H:
源代码
//student.java:
程序的入口。
初始化界面,使主界面位于屏幕中间,且用户不
能改变大小
//功能:
完成程序的执行顺序
importjavax.swing.UIManager;
importjava.awt.*;
importjava.sql.*;
//importscreen
publicclassstudent
{
booleanpackFrame=false;
//JFrameframe=newJFrame();
publicstudent()
{
mainframeframe=newmainframe();if(packFrame)
{
frame.pack();
}
else{
frame.validate();
}
Dimension
screenSize=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
{try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");//加载驱动
}
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.*;
importjava.awt.event.*;
importjavax.swing.*;
importjava.sql.*;
implementsActionListener
publicclassmainframeextendsJFrame{
staticmainframes;
staticJPanelpan=newJPanel();
staticJLabellabel1=newJLabel("用户");
staticJLabellabel2=newJLabel("密码");
staticJTextFieldtextField1=newJTextField();
staticJPasswordFieldpassword=newJPasswordField();
staticJButtonbutton1=newJButton("进入系统");
管理员",true);//
学生");
教师");
staticJRadioButtonradioButton1=newJRadioButton(
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,"登陆成功");
"".equals(password.getText())){
JOptionPane.showMessageDialog(null,"用户名或密码不能为空");
}else{
JOption
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 完整版 学生 学籍 管理 系统 java 源代码