文件名称:00
介绍说明--下载内容均来自于网络,请自行研究使用
(1)编程思路:本例因为要制作计算器,所以首先定义具有计算功能的类Calculator。在类Calculator中定义处理加减乘除运算的函数,分别命名为opAdd (),opSubtract(),opMultiply(),opDivide()。然后,因为要实现实现人机交互的效果,所以先要定义实现用户界面类CalculatorGUI。通过Panel类的setLayout()函数进行用户界面的布局。此外,要通过actionPerformed(ActionEvent event))函数来实现对按钮事件的监听,并根据不同的按钮事件进行不同的运算。最后,因为要实现用户界面类与处理运算类的融合.,所以要在用户界面类(CalculatorGUI)中定义处理运算类(Calculator)的对象,这样,就完成了计算器的功能。-(1) programming ideas: in this case because to make the calculator, so first class definition Calculator with calculating functions. Defined handler arithmetic operations in the class Calculator, named as opAdd (), opSubtract (), opMultiply (), opDivide (). Then, because to achieve the realization of the effect of human-computer interaction, so the user interface must first define the implementation class CalculatorGUI. () Function layout of the user interface by the Panel class setLayout. In addition, to be implemented on the button event listener through actionPerformed (ActionEvent event)) function, and different operations depending on the button event. Finally, because the user interface classes to achieve fusion and processing operation class. Therefore, the user interface for the class (CalculatorGUI) process operation as defined in class (Calculator) object, so to complete the functions of the calculator.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
练习100计算器\Calculator.class
.............\Calculator.java
.............\CalculatorGUI.class
.............\CalculatorGUI.java
.............\_desktop.ini
.............\练习100计算器.doc
练习100计算器