JAVA成绩管理系统论文Word文档下载推荐.docx

上传人:b****5 文档编号:21796219 上传时间:2023-02-01 格式:DOCX 页数:32 大小:2.95MB
下载 相关 举报
JAVA成绩管理系统论文Word文档下载推荐.docx_第1页
第1页 / 共32页
JAVA成绩管理系统论文Word文档下载推荐.docx_第2页
第2页 / 共32页
JAVA成绩管理系统论文Word文档下载推荐.docx_第3页
第3页 / 共32页
JAVA成绩管理系统论文Word文档下载推荐.docx_第4页
第4页 / 共32页
JAVA成绩管理系统论文Word文档下载推荐.docx_第5页
第5页 / 共32页
点击查看更多>>
下载资源
资源描述

JAVA成绩管理系统论文Word文档下载推荐.docx

《JAVA成绩管理系统论文Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《JAVA成绩管理系统论文Word文档下载推荐.docx(32页珍藏版)》请在冰豆网上搜索。

JAVA成绩管理系统论文Word文档下载推荐.docx

(4)美化窗口界面,完善各项功能

1.2.1UML图

1.2.2界面设计

先设计出大致界面,最后美化界面,加入一些背景,设计按钮。

下面是最初的草图设计:

二、程序代码与解析

3.1学生成绩管理系统.java

publicclass学生成绩管理系统{

publicstaticvoidmain(String[]args){

Interfaceinterface1=newInterface();

interface1.setTitle("

成绩管理系统"

);

}

}

//学生成绩管理系统为主类,调用Interface来打开主界面。

3.2FinalTable.java

//此类为主界面,即包含题目,四个功能选择按钮的界面

importjava.awt.*;

importjava.awt.event.*;

importjava.io.IOException;

import.URISyntaxException;

importjavax.swing.*;

importstaticjava.awt.BorderLayout.*;

publicclassInterfaceextendsJFrameimplementsActionListener{

JPanelpanel;

JButtonbutton1,button2,button3,button4;

//button1添加按钮button2查询按钮

//button3修改按钮button4校园网按钮

JLabellabel,labelTitle,label1,label2,label3,label4;

//label1,label2,label3,label4

//为添加,查询,修改,校园网这几个按钮的注释,labelTitle为"

这几个字,label用于

//添加背景

ImageIcon背景;

//背景为整个界面的背景,通过添加图片设置为背景

Iconicon1,icon2,icon3,icon4;

//按钮图标

Boxbasebox,boxV1,boxV2,boxV3,boxV4;

publicInterface(){

//添加背景,添加标题,设置按钮图标

labelTitle=newJLabel("

Fontfont=newFont("

华文行楷"

Font.BOLD+Font.TRUETYPE_FONT+Font.LAYOUT_LEFT_TO_RIGHT,70);

labelTitle.setFont(font);

labelTitle.setForeground(newColor(255,0,0));

背景=newImageIcon("

001.JPG"

label=newJLabel(背景);

label.setBounds(0,0,背景.getIconWidth(),

背景.getIconHeight());

this.getLayeredPane().setLayout(null);

icon1=newImageIcon("

1.png"

button1=newJButton(icon1);

button1.setContentAreaFilled(false);

icon2=newImageIcon("

2.png"

button2=newJButton(icon2);

button2.setContentAreaFilled(false);

icon3=newImageIcon("

3.png"

button3=newJButton(icon3);

button3.setContentAreaFilled(false);

icon4=newImageIcon("

4.png"

button4=newJButton(icon4);

button4.setContentAreaFilled(false);

//设置按钮的解释文字的字体和颜色,并把按钮和其对应的文字说明用BoxLayout布局

//设置为上下对其形式

Fontfont1=newFont("

微软雅黑"

Font.BOLD+Font.TRUETYPE_FONT+Font.LAYOUT_LEFT_TO_RIGHT,17);

label1=newJLabel("

添加"

label2=newJLabel("

查询"

label3=newJLabel("

修改"

label4=newJLabel("

校园网"

label1.setFont(font1);

label2.setFont(font1);

label3.setFont(font1);

label4.setFont(font1);

label1.setForeground(newColor(255,255,255));

label2.setForeground(newColor(255,255,255));

label3.setForeground(newColor(255,255,255));

label4.setForeground(newColor(255,255,255));

boxV1=Box.createVerticalBox();

boxV2=Box.createVerticalBox();

boxV3=Box.createVerticalBox();

boxV4=Box.createVerticalBox();

boxV1.add(button1);

boxV1.add(Box.createVerticalStrut(0));

boxV1.add(label1);

boxV2.add(button2);

boxV2.add(Box.createVerticalStrut(0));

boxV2.add(label2);

boxV3.add(button3);

boxV3.add(Box.createVerticalStrut(0));

boxV3.add(label3);

boxV4.add(button4);

boxV4.add(Box.createVerticalStrut(0));

boxV4.add(label4);

basebox=Box.createHorizontalBox();

basebox.add(boxV1);

basebox.add(Box.createHorizontalStrut(11));

basebox.add(boxV2);

basebox.add(boxV3);

basebox.add(boxV4);

add(basebox,SOUTH);

//添加背景,并把窗口大小设置为背景图片的大小

panel=(JPanel)this.getContentPane();

panel.setOpaque(false);

FlowLayoutf=newFlowLayout();

panel.add(labelTitle);

panel.setLayout(f);

getLayeredPane().setLayout(null);

getLayeredPane().add(label,newInteger(Integer.MIN_VALUE));

setSize(背景.getIconWidth(),背景.getIconHeight());

setBounds(350,150,背景.getIconWidth(),背景.getIconHeight());

setVisible(true);

setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

//为每个按钮设置监视器

button1.addActionListener(this);

button2.addActionListener(this);

button3.addActionListener(this);

button4.addActionListener(this);

@Override

publicvoidactionPerformed(ActionEvente){

//TODOAuto-generatedmethodstub

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

InterfaceDesign2interface2=newInterfaceDesign2();

//当按下button2时,打开InterfaceDesign2的窗口

}

elseif(e.getSource()==button3){

InterfaceDesign4interface4=newInterfaceDesign4();

//当按下button3时,打开InterfaceDesign4的窗口

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

InterfaceDesign3interface3=newInterfaceDesign3();

//当按下button1时,打开InterfaceDesign3的窗口

elseif(e.getSource()==button4){

//当按下button4的时候,连接校园网,此处用了jdk1.6版本的特有功能,

//用电脑默认的浏览器,打开预设在程序里的东北大学秦皇岛分校的网页

Desktopdp=Desktop.getDesktop();

try{

dp.browse(new.URI("

}catch(IOExceptione1){

//TODOAuto-generatedcatchblock

e1.printStackTrace();

}catch(URISyntaxExceptione1){

}

}

3.3InterfaceDesign2.java

//查询功能窗口

publicclassInterfaceDesign2extendsJFrameimplementsActionListener{

JLabelnumber;

//学号

JTabletable1=newJTable();

//用于接收由FinalTable查找出来的信息反回来的JTable类型的结果

JTextFieldnumbertext;

//输入学号的文本框

JButtonseekByNumber;

//"

查询"

按钮

JButtonseekAll;

总成绩排名查询"

//用于设置背景

JLabellabel;

ImageIconbackground;

publicInterfaceDesign2(){

init();

setBounds(350,150,background.getIconWidth(),background.getIconHeight());

setTitle("

voidinit(){

//为窗口添加背景

background=newImageIcon("

010.JPG"

label=newJLabel(background);

label.setBounds(0,0,background.getIconWidth(),

background.getIconHeight());

setSize(background.getIconWidth(),background.getIconHeight());

//添加文本框和按钮

setLayout(newFlowLayout());

number=newJLabel("

学号"

numbertext=newJTextField(10);

seekByNumber=newJButton("

seekAll=newJButton("

add(number);

add(numbertext);

add(seekByNumber);

add(seekAll);

seekByNumber.addActionListener(this);

seekAll.addActionListener(this);

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

//若学好输入框没有输入学号,提示输入学号信息

if(numbertext.getText().length()==0){

JOptionPane.showMessageDialog(this,

"

请输入学号!

"

"

JOptionPane.WARNING_MESSAGE);

else{

//把输入的学号读入SQL语句,将SQL语句传给FinalTable类,

//把查询结果反回给table1,并将table1添加到窗口中

Stringstr=numbertext.getText();

FinalTabletable=newFinalTable();

table.setSQL("

SELECT*FROM成绩表where学号="

+Integer.parseInt(str));

table1=table.finalTable();

add(newJScrollPane(table1),SOUTH);

validate();

elseif(e.getSource()==seekAll){

////将SQL按总分排名顺序的语句传给FinalTable类,

//把查询结果反回给table1,并将table1添加到窗口中

SELECT*FROM成绩表orderby总分DESC"

3.4InterfaceDesign3.java

//按下添加按钮后的添加新记录的界面

importjava.awt.Color;

importjava.awt.FlowLayout;

importjava.awt.Font;

publicclassInterfaceDesign3extendsJFrameimplementsActionListener{

Boxbasebox,boxV1,boxV2;

//用BoxLayout布局来设置添加的JTextField文本框和对应的说明

JTextFieldtext1,text2,text3,text4,text5,text6;

JButtonadd;

JLabellabel1,label2,label3,label4,label5,label6;

//用于设置背景所用到的变量

publicInterfaceDesign3(){

setDefaultCloseOperation(DISPOSE_ON_CLOSE);

添加"

//添加背景图片

012.JPG"

//添加按钮极其注释文字,并设置字体颜色,大小

add=newJButton(newImageIcon("

d.png"

));

add(add);

//添加背景,并设置窗口大小为背景大小

add.setContentAreaFilled(false);

panel.add(add);

setBounds(350,150,background.getIconWidth(),background.getIconHeight());

Font.BOLD+Font.TRUETYPE_FONT+Font.LAYOUT_LEFT_TO_RIGHT,15);

学号"

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

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

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

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