《Java语言程序设计2》项目设计说明书.docx

上传人:b****1 文档编号:13803239 上传时间:2023-06-17 格式:DOCX 页数:27 大小:546.28KB
下载 相关 举报
《Java语言程序设计2》项目设计说明书.docx_第1页
第1页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第2页
第2页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第3页
第3页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第4页
第4页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第5页
第5页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第6页
第6页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第7页
第7页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第8页
第8页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第9页
第9页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第10页
第10页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第11页
第11页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第12页
第12页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第13页
第13页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第14页
第14页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第15页
第15页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第16页
第16页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第17页
第17页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第18页
第18页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第19页
第19页 / 共27页
《Java语言程序设计2》项目设计说明书.docx_第20页
第20页 / 共27页
亲,该文档总共27页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

《Java语言程序设计2》项目设计说明书.docx

《《Java语言程序设计2》项目设计说明书.docx》由会员分享,可在线阅读,更多相关《《Java语言程序设计2》项目设计说明书.docx(27页珍藏版)》请在冰点文库上搜索。

《Java语言程序设计2》项目设计说明书.docx

《Java语言程序设计2》项目设计说明书

无锡科技职业学院

《Java语言程序设计

(2)》项目设计

说明书

设计题目:

_____________________

班级:

_____________________

学号:

_____________________

姓名:

_____________________

指导教师:

_____________________

完成日期:

_____________________

 

软件与服务外包学院制

目录

一、需求分析┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅3

二、模块功能说明(概要设计)┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅4

三、详细设计┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅5

四、任务进度表┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅6

五、测试结果┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅7

六、设计小结┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅9

七、用户使用说明┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅10

八、参考文献┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅10

一、

模块功能说明(概要设计)

 

二、模块功能说明(概要设计)

1.登陆:

使用设定好的账号登陆。

界面如下:

登陆后的界面:

(原本看不到菜单,现在可以显示)

 

2.菜单的设计(如下图)

3.“增加”功能,输入数据后,点击“增加”便增加。

下图为查询结果。

 

4.“修改”功能,如图将“班级”这一栏数据进行修改,再进行查询。

查询成功!

 

5.删除。

将刚刚查询到的结果进行“删除”,再进行查询。

 

6.生成文档

点击“生成文档”后,可在指定路径下查找到指定文件,打开文件可以看到指定内容。

(如下图)

完成人签名:

三、

详细设计

importjavax.swing.JFrame.*;

publicclassMain{

publicstaticvoidmain(Stringargs[]){

LLcc=newLL("袁杰100120455",111,111,500,300);

}

}

importjavax.swing.*;

importjava.io.*;

importjava.util.*;

importjava.awt.Button;

importjava.awt.GridLayout;

importjava.awt.Label;

importjava.awt.TextField;

importjava.awt.event.*;

importjava.io.BufferedWriter;

importjava.io.File;

importjava.io.FileWriter;

importjava.io.IOException;

importjava.io.Writer;

importjava.util.Vector;

importstaticjavax.swing.JFrame.*;

publicclassLLextendsJFrameimplementsActionListener{

VectorStuInf=newVector();

Stringstu="name:

number:

class:

point:

"+"\r\n";

StudentInfSI;

Stringxm;

Stringbj;

inti,j,xh,cj;

staticintmid;

JMenuBarb;

JMenuc;

JMenuItemd,e,f,g,h;

JLabelprompt1=newJLabel("学生成绩管理系统");

JLabela1=newJLabel("菜单隐藏已解除说明:

");

JLabela2=newJLabel("请先添加数据再操作");

JLabela4=newJLabel("填写完数据再添加,按学号");

JLabela3=newJLabel("来查询,查询完修改或删除");

JLabelprompt2=newJLabel("用户:

(初始1)");

JLabelprompt3=newJLabel("密码:

(初始1)");

Labelprompt4=newLabel("班级:

");

Labelprompt5=newLabel("成绩:

");

TextFieldinput1=newTextField(8);

TextFieldinput2=newTextField(8);

TextFieldinput3=newTextField(8);

TextFieldinput4=newTextField(8);

Buttonbtn1=newButton("登录");

Buttonbtn11=newButton("生成文档(D:

/yj.txt)");

Stringq="1",qq="1";

publicLL(){};

publicLL(Stringa,intb,intc,intd,inte){

init(a);

setLocation(b,c);

setSize(d,e);

setVisible(true);

setDefaultCloseOperation(DISPOSE_ON_CLOSE);

}

voidinit(Strings){

setTitle(s);

setSize(400,300);

setLayout(newGridLayout(6,3));

add(newLabel());

add(prompt1);

add(newLabel());

add(prompt2);

add(input1);

add(newLabel());

add(prompt3);

add(input2);

add(btn1);

add(btn11);

add(prompt4);

add(input3);

add(input4);

add(btn11);

add(prompt5);

add(input4);

add(a4);

add(a1);

add(a2);

add(a3);

b=newJMenuBar();

c=newJMenu("菜单");

d=newJMenuItem("增加");

e=newJMenuItem("查询");

f=newJMenuItem("修改");

g=newJMenuItem("删除");

h=newJMenuItem("关闭");

d.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,InputEvent.CTRL_MASK));

e.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,InputEvent.CTRL_MASK));

f.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S,InputEvent.CTRL_MASK));

g.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D,InputEvent.CTRL_MASK));

h.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E,InputEvent.CTRL_MASK));

prompt4.setVisible(false);

prompt5.setVisible(false);

input3.setVisible(false);

input4.setVisible(false);

btn11.setVisible(false);

c.setVisible(false);

a1.setVisible(false);

a2.setVisible(false);

a3.setVisible(false);

a4.setVisible(false);

btn1.addActionListener(this);

d.addActionListener(this);

e.addActionListener(this);

f.addActionListener(this);

g.addActionListener(this);

btn11.addActionListener(this);

c.addMouseListener(newMouseListener(){

@Override

publicvoidmouseClicked(MouseEvente){

//TODOAuto-generatedmethodstub

b.updateUI();

}

@Override

publicvoidmousePressed(MouseEvente){

//TODOAuto-generatedmethodstub

b.updateUI();

}

@Override

publicvoidmouseReleased(MouseEvente){

//TODOAuto-generatedmethodstub

b.updateUI();

}

@Override

publicvoidmouseEntered(MouseEvente){

//TODOAuto-generatedmethodstub

b.updateUI();

}

@Override

publicvoidmouseExited(MouseEvente){

//TODOAuto-generatedmethodstub

b.updateUI();

}

});

h.addActionListener(newActionListener(){

@Override

publicvoidactionPerformed(ActionEvente){

//TODOAuto-generatedmethodstub

System.exit(0);

}

});

c.add(d);

c.add(e);

c.add(f);

c.add(g);

c.add(h);

b.add(c);

setJMenuBar(b);

}

publicvoidactionPerformed(ActionEvente)

{

if(e.getActionCommand()=="登录")

{

Stringa,b;

a=input1.getText();

b=input2.getText();

input1.setText("");

if((a.equals(q)==true)&&(b.equals(qq)==true))

{

prompt2.setText("姓名:

");

prompt3.setText("学号:

");

prompt4.setVisible(true);

prompt5.setVisible(true);

input3.setVisible(true);

input4.setVisible(true);

c.setVisible(true);

d.setVisible(true);

f.setVisible(true);

g.setVisible(true);

a1.setVisible(true);

a2.setVisible(true);

a3.setVisible(true);

a4.setVisible(true);

f.setEnabled(false);

g.setEnabled(false);

btn1.setVisible(true);

btn11.setVisible(true);

btn1.setLabel("清除");

input1.setText("");

input2.setText("");

input1.selectAll();

}

else

input2.setText("用户名或密码错");

}

if(e.getActionCommand()=="清除")

{

input1.setText("");

input2.setText("");

input3.setText("");

input4.setText("");

}

if(e.getActionCommand()=="增加")

{

booleanscucss=true;

try

{

XingMing();

}

catch(EmptyExceptionas)

{

input1.setText("姓名不能为空");

scucss=false;

}

try

{

xh=Integer.parseInt(input2.getText());

}

catch(NumberFormatExceptionm)

{

input2.setText("学号为空或格式错");

scucss=false;

}

bj=input3.getText();

try

{

ChengJi();

}

catch(EmptyExceptionas)

{

cj=-1;

}

catch(OverExceptiondd)

{

input4.setText("应在0-100间");

scucss=false;

}

catch(NumberFormatExceptioncm)

{

input4.setText("成绩应为数据");

scucss=false;

}

if(scucss==true)

{

stu+=(""+input1.getText()+"");

stu+=(""+input2.getText()+"");

stu+=(input3.getText()+"");

stu+=(input4.getText()+"");

stu+=("\r\n");

SI=newStudentInf(xm,xh,bj,cj);

Insert(SI);

}

repaint(1,111,111,500,300);

}

if(e.getActionCommand()=="修改")

{

xm=input1.getText();

xh=Integer.parseInt(input2.getText());

bj=input3.getText();

cj=Integer.parseInt(input4.getText());

SI=newStudentInf(xm,xh,bj,cj);

StuInf.setElementAt(SI,mid);

f.setEnabled(false);

}

if(e.getActionCommand()=="删除")

{

StuInf.removeElementAt(mid);

g.setEnabled(false);

input1.setText("删除成功");

input2.setText("");

input3.setText("");

input4.setText("");

}

if(e.getActionCommand()=="查询")

{

booleanright=true;

try

{

xh=Integer.parseInt(input2.getText());

}

catch(NumberFormatExceptionm)

{

input2.setText("学号为空或格式错");

right=false;

}

if(right==true)

{

search(xh);

f.setEnabled(true);

g.setEnabled(true);

}

}

if(e.getActionCommand()=="生成文档(D:

/yj.txt)")

{

ObjectOutputStreamout;

try{

out=newObjectOutputStream(

newFileOutputStream("d:

/yj.txt"));

out.writeObject(stu);

//out.writeUTF(stu);

out.flush();

out.close();

}catch(FileNotFoundExceptione1){

//TODOAuto-generatedcatchblock

e1.printStackTrace();

}catch(IOExceptione1){

//TODOAuto-generatedcatchblock

e1.printStackTrace();

}

}

}

//查找方法

publicvoidsearch(intk)

{

booleanexist=false;

intlow=0;

inthigh=StuInf.size()-1;

while(low<=high)

{

mid=(high+low)/2;

StudentInfa1=(StudentInf)StuInf.elementAt(mid);

if(a1.getStuNo()==k)

{

SI=(StudentInf)StuInf.elementAt(mid);

Stringx=String.valueOf(SI.getStuNo());

exist=true;

input1.setText(SI.getname());

input1.selectAll();

input2.setText("0"+x);

input3.setText(SI.getClassNo());

if(SI.getLevel()==-1)

input4.setText("未参加考试");

else

{

Stringy=String.valueOf(SI.getLevel());

input4.setText(y);

}

break;

}

elseif(a1.getStuNo()

low=mid+1;

else

high=mid-1;

}

if(exist==false)

{

input1.setText("无此学号学生信息");

input1.selectAll();

}

}

//添加方法

publicvoidInsert(StudentInfq)

{

inti=0;

if(StuInf.isEmpty()==true)

{

StuInf.addElement(q);

input1.setText("");

input2.setText("");

input3.setText("");

input4.setText("");

}

else

{

StudentInfxh;

xh=(StudentInf)StuInf.firstElement();

while(xh.getStuNo()

{

i++;

if(i

xh=(StudentInf)StuInf.elementAt(i);

else

break;

}

if(xh.getStuNo()==q.getStuNo())

{

input2.setText("此学生信息已存在");

input2.requestFocus();

input2.selectAll();

}

else

{

StuInf.insertElementAt(q,i);

input1.setText("");

input2.setText("");

input3.setText("");

input4.setText("");

}

}

}

//异常类

classOverExceptionextendsException

{

Stringover;

}

classEmptyExceptionextendsException

{

Stringempty;

}

void

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

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2