资源预览内容
第1页 / 共14页
第2页 / 共14页
第3页 / 共14页
第4页 / 共14页
第5页 / 共14页
第6页 / 共14页
第7页 / 共14页
第8页 / 共14页
第9页 / 共14页
第10页 / 共14页
亲,该文档总共14页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
The Java task - graphical calendar Name:XiaotongYangBTEC-11222132012/5/25CatalogCatalog21. Structured programming31.1 Structured programming principle31.2 Structured programming features31.3 Structured programming32. Calendar design42.1 Structure design4(1) File structure design4(2) The design of data structure42.2 The perpetual calendar function design5(1) Overall function design and process5(2) Each module function design and flow5(3) User interface design63. Production of the calendar73.1 Procedures used in the control structure is introduced73.2 Procedures for the various functions and parameters73.3 Program all the code74. The production process problems and Solutions135. Calendar of the algorithms and theory146. Summary and evaluation151. Structured programming1.1 Structured programming principle It uses a subroutine, code blocks ( English: block structures ), for cycle and while cycle structure, to replace the traditional goto. Hoping to improve computer program clarity, quality and development time, and avoid to write spaghetti code.1.2 Structured programming features Structured programming must be the function of the system of rational analysis, decomposition and synthesis, so the related personnel requirements higher, in addition, when using a structured programming method, the need for data management.1.3 Structured programming Structured programming structured programming theory as theoretical basis, structured programming theory mentions the use of sequential, selection and repeat the three assembly programming way, can be said that all computable functions. The three structure is sufficient to express CPU instruction cycle, can also mean that the Turing machine operation, this point of view, the processor executes the instruction can be seen as a structured programming, although the program may not be a structured programming. Generally considered the structured programming theory is attributed to Boehm and Jaakko Pini in 1966published papers, one reason may be that Dykstra quoted in this paper. Structured programming theory without mention of how to write a structured program, there is no mention of structured program analysis, then1960 to1970in the 1970s, Deckard Stella, Robert Floyd, Tony Hall and other computer scientists in this field have many contributions.2. Calendar design2.1 Structure design(1) File structure designComponent window, button, text box, select box, scroll bars, query the event processing and date calculation(2) The design of data structuresearchMonth = calendar.get (Calendar.MONTH);searchYear = calendar.get(Calendar.YEAR);tfYear.setText (String.valueOf (searchYear);for(int i = 0; i 12; i +)monthChoice.addItem (months i );/增加下拉框选项g.setColor (color.lightGray);/设置当前颜色g.setFont (bigFont);/设置当前使用字体g.drawString (searchYear+”年”, 60, TOP+70);/绘制字符串g.drawString (searchMonth + 1) +”月”, 200, TOP + 130);For (int I = 0; I = totalWidth; I += CELLWIDTH)g.drawLine (i, TOP, i, TOP +totalHeight);2.2 The perpetual calendar function design(1) Overall function design and process I design calendar year and the month to enter the query, click the update button, you can get the corresponding calendar. Its convenient for the user s query. This calendar is the graphical user interface of the calendar. The main process is the interface design, query the event processing and date calculation.(2) Each module function design and flow Query and display part: The query input portion includes a text field, for the input year , a selected drop-down box, used to select month , an update button, to start querying the event. Query event processing part: Event target attribute can be the event source, it is used with button example are compared, can know the time is derived from the button.After the incident, respectively, call the getText method and getSelectedIndex method from the year and month selector input text field drop-down box to obtain query of the year and the month. Note that, from the text field of the results obtained for the string, you need to call the Integer classs parseInt method to convert it to an integer value.The GregorianCalenda class time is calculated from the beginning of 1581, when the user inputs a time earlier than the time, need to handle. Program first calls the repaint method to redraw the screen, put the date information display. The date of calculation section: Date of the calculation includes mainly calculate every year the first day and the first day of the month.(3) User interface design The interface is mainly composed of two parts - the query input portion and a display part. The query input portion having a se
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号