欢迎来到天天文库
浏览记录
ID:55534996
大小:29.00 KB
页数:5页
时间:2020-05-16
《软件详细设计报告文档模板.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、软件详细设计报告文档模板1.引言1.1编写目的设计一个简单的计算器1.2背景A.简易计算器B.用java语言编写1.3参考资料参考《java程序设计》2.设计概述2.1任务和目标说明详细设计的任务及详细设计所要达到的目标。1.1.1需求概述支持GUI界面有计算结果的输出区域能够处理输入的0-9数字单击清除键清空输入历史和结果不支持优先级计算1.1.2运行环境概述Jdk1.61.系统详细设计1.1系统界面详细设计1.1.1外部界面设计importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;导包awtswing和event
2、publicclassJCalculatorextendsJFrameimplementsActionListener{/***SerialVersionUID*/privatestaticfinallongserialVersionUID=-L;/***ThisclasshelpclosetheWindow.**/privateclassWindowCloserextendsWindowAdapter{publicvoidwindowClosing(WindowEventwe){System.exit(0);}}inti;//StringsforDigit&Operatorbut
3、tons.privatefinalString[]str={"7","8","9","/","4","5","6","*","1","2","3","-",".","0","=","+"};//Buildbuttons.JButton[]buttons=newJButton[str.length];//Forcancelorreset.JButtonreset=newJButton("CE");//Buildthetextfieldtoshowtheresult.JTextFielddisplay=newJTextField("0");//界面的布局。publicJCalculat
4、or(){super("Calculator");//Addapanel.JPanelpanel1=newJPanel(newGridLayout(4,4));//panel1.setLayout(newGridLayout(4,4));for(i=0;i5、ter",display);panel2.add("East",reset);//JPanelpanel3=newPanel();getContentPane().setLayout(newBorderLayout());getContentPane().add("North",panel2);getContentPane().add("Center",panel1);//Addactionlistenerforeachdigit&operatorbutton.for(i=0;i6、/Addlistenerfor"reset"button.reset.addActionListener(this);//Addlistenerfor"display"button.display.addActionListener(this);//The"close"button"X".addWindowListener(newWindowCloser());//Initializethewindowsize.setSize(800,800);//Showthewindow.//show();Usingshow()whileJDKversionisbelow1.5.setVisi7、ble(true);//Fitthecertainsize.pack();}//初始化界面publicvoidactionPerformed(ActionEvente){Objecttarget=e.getSource();Stringlabel=e.getActionCommand();if(target==reset)handleReset();elseif(".".indexOf(label)>0)handleNumber(label);elsehandleOp
5、ter",display);panel2.add("East",reset);//JPanelpanel3=newPanel();getContentPane().setLayout(newBorderLayout());getContentPane().add("North",panel2);getContentPane().add("Center",panel1);//Addactionlistenerforeachdigit&operatorbutton.for(i=0;i6、/Addlistenerfor"reset"button.reset.addActionListener(this);//Addlistenerfor"display"button.display.addActionListener(this);//The"close"button"X".addWindowListener(newWindowCloser());//Initializethewindowsize.setSize(800,800);//Showthewindow.//show();Usingshow()whileJDKversionisbelow1.5.setVisi7、ble(true);//Fitthecertainsize.pack();}//初始化界面publicvoidactionPerformed(ActionEvente){Objecttarget=e.getSource();Stringlabel=e.getActionCommand();if(target==reset)handleReset();elseif(".".indexOf(label)>0)handleNumber(label);elsehandleOp
6、/Addlistenerfor"reset"button.reset.addActionListener(this);//Addlistenerfor"display"button.display.addActionListener(this);//The"close"button"X".addWindowListener(newWindowCloser());//Initializethewindowsize.setSize(800,800);//Showthewindow.//show();Usingshow()whileJDKversionisbelow1.5.setVisi
7、ble(true);//Fitthecertainsize.pack();}//初始化界面publicvoidactionPerformed(ActionEvente){Objecttarget=e.getSource();Stringlabel=e.getActionCommand();if(target==reset)handleReset();elseif(".".indexOf(label)>0)handleNumber(label);elsehandleOp
此文档下载收益归作者所有