基于JAVA的学生成绩管理系统源代码Word文档格式.docx

上传人:b****5 文档编号:20751531 上传时间:2023-01-25 格式:DOCX 页数:21 大小:79.93KB
下载 相关 举报
基于JAVA的学生成绩管理系统源代码Word文档格式.docx_第1页
第1页 / 共21页
基于JAVA的学生成绩管理系统源代码Word文档格式.docx_第2页
第2页 / 共21页
基于JAVA的学生成绩管理系统源代码Word文档格式.docx_第3页
第3页 / 共21页
基于JAVA的学生成绩管理系统源代码Word文档格式.docx_第4页
第4页 / 共21页
基于JAVA的学生成绩管理系统源代码Word文档格式.docx_第5页
第5页 / 共21页
点击查看更多>>
下载资源
资源描述

基于JAVA的学生成绩管理系统源代码Word文档格式.docx

《基于JAVA的学生成绩管理系统源代码Word文档格式.docx》由会员分享,可在线阅读,更多相关《基于JAVA的学生成绩管理系统源代码Word文档格式.docx(21页珍藏版)》请在冰豆网上搜索。

基于JAVA的学生成绩管理系统源代码Word文档格式.docx

1、输入十个同学的学号,姓名,出生日期,二科成绩(学,大学英语)。

2、输入学号查询学生信息。

3、删除记录

4、查询记录

5、添加记录

6、修改记录

三:

代码

第一部分:

publicclassmain{

publicstaticvoidmain(String[]args){

zhuchuangkouwin=newzhuchuangkou();

}

}

第二部分主界面:

importjava.awt.*;

importjava.awt.event.*;

importjavax.swing.*;

importjavax.swing.border.*;

publicclasszhuchuangkouextendsFrameimplementsActionListener{

Buttonbutton1,button2,button3,button4,tuichu;

Panelp1,p2,p3;

Labell1,l2,l3;

TextFielda1,a2;

Boxb1,b2,b3,b4,b5;

sss;

zhuchuangkou(){

button1=newButton("

登陆"

);

button2=newButton("

删除"

button3=newButton("

修改"

button4=newButton("

添加"

tuichu=newButton("

退出"

p1=newPanel();

p2=newPanel();

p3=newPanel();

l1=newLabel("

学生成绩管理"

Label.CENTER);

l1.setFont(newFont("

宋体"

Font.BOLD,72));

l1.setBackground(Color.green);

l2=newLabel("

登录名"

l3=newLabel("

密码"

a1=newTextField(10);

a2=newTextField(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(newWindowAdapter(){

publicvoidwindowClosing(WindowEvente){

dispose();

}

});

setBackground(Color.RED);

setBounds(10,10,1000,500);

setVisible(true);

validate();

publicvoidactionPerformed(ActionEvente){

if(e.getSource()==tuichu){

System.exit(0);

}

if(e.getSource()==button1){

if(a1.getText().equals("

liuzhenji"

)&

&

a2.getText().equals("

123456"

)){

newchuankou();

System.out.println("

wwwww"

else{

System.out.print("

nishurucuowu"

第三部分选择操作:

第四部分查询界面实现:

importjava.sql.*;

importjavax.swing.JOptionPane;

publicclassssextendsFrameimplementsTextListener,ActionListener{

Buttonxunzhao;

TextFieldinput;

TextAreashow;

Strings;

intk;

Connectioncon;

Statementsql;

intsum=0;

ResultSetrs;

ss(){

Panelp=newPanel();

xunzhao=newButton("

查找"

input=newTextField(10);

show=newTextArea(6,43);

p.add(newLabel("

输入学号"

));

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

publicvoidactionPerformed(ActionEventee){

booleanboo=true;

s=input.getText();

k=Integer.parseInt(s);

try{Class.forName("

sun.jdbc.odbc.JdbcOdbcDriver"

catch(ClassNotFoundExceptioneee)

{System.out.println("

"

+eee);

try{con=DriverManager.getConnection("

jdbc:

odbc:

sun"

"

gxy"

123"

sql=con.createStatement();

rs=sql.executeQuery("

SELECT*FROMchengjibiao"

while(rs.next())

{

intnumber=rs.getInt("

number"

Stringname=rs.getString("

name"

Stringdate=rs.getString("

birthday"

intmath=rs.getInt("

math"

intenglish=rs.getInt("

english"

if(number==k)

{boo=false;

show.setText(null);

show.append("

学号:

+number+"

姓名:

+name+"

出生:

+date+"

数学"

+math+"

英语"

+english);

show.append("

\n"

con.close();

if(boo){

JOptionPane.showMessageDialog(this,"

你输入的学号不存在"

catch(SQLExceptioneee)

{System.out.println(eee);

}

第五部分删除:

publicclassshanchuextendsFrameimplementsTextListener,ActionListener{

intk,s1,j;

shanchu(){

输入要删除的"

+"

学号"

Stringm,dir;

try{Class.forName("

+eee);

sql=con.createStatement();

SELECT*FROMchengjibiao"

{intnumber=rs.getInt

(2);

Stringname=rs.getString(3);

Stringdate=rs.getString("

if(number==k){

show.setText("

你删除了:

m="

DELETEFROMchengjibiaoWHEREnumber="

+k+"

;

sql.executeUpdate(m);

catch(SQLExceptione)

{System.out.println(e);

}

第六部分修改:

publicclassxiugaiextendsFrameimplementsTextListener,ActionListener{

Buttoncharu;

TextFieldinput1,input2,input3,input4,input5,input6;

Panelp1,p2;

xiugai(){

p1=newPanel();

p2=newPanel();

charu=newButton("

input1=newTextField(10);

input2=newTextField(10);

input3=newTextField(10);

input4=newTextField(10);

input5=newTextField(10);

input6=newTextField(10);

p1.add(newLabel("

请输入要修改的学号"

p1.add(input1);

p2.add(newLabel("

请输入修改的数据"

p2.add(input2);

date"

p2.add(input3);

p2.add(input4);

p2.add(input5);

p2.add(charu);

charu.addActionListener(this);

setBounds(10,30,1200,200);

Strings0,s1,s2,s3,s4,s5,insert1,recode,name,dat

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

当前位置:首页 > PPT模板 > 其它模板

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

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