文件名称:Javacaculator
介绍说明--下载内容均来自于网络,请自行研究使用
使用Java制作计算器的实例,适合学习的Java源码下载。运用了Java2的图形界面技术和消息响应技术。通过图形界面技术,制作了计算器的用户界面。通过消息响应技术,实现响应用户的操作的功能,最终实现人机交互。用到的JAVA知识点有:窗口布局器GridLayout的应用,对按钮消息的监听和响应。
程序及注释
首先定义具有计算功能的类Calculator。在类Calculator中定义处理加减乘除运算的函数,分别命名为opAdd (),opSubtract(),opMultiply(),opDivide()。然后实现人机交互效果,要先定义实现用户界面类CalculatorGUI。通过Panel类的setLayout()函数进行用户界面的布局。此外,要通过actionPerformed(ActionEvent event))函数来实现对按钮事件的监听,并根据不同的按钮事件进行不同的运算。最后实现用户界面类与处理运算类的融合.,所以要在用户界面类(CalculatorGUI)中定义处理运算类(Calculator)的对象,这样,就完成了计算器的功能-Making use of Java calculator examples for learning Java source code download . Use of technology Java2 graphical interface and message response technology . Graphical interface technology , making the user interface of the calculator . By message response technology, features in response to user actions , and ultimately human-computer interaction . JAVA knowledge points used are: window layout is GridLayout applications for the button to listen and respond to the message .
Procedures and Notes
First class definition Calculator with calculating functions . Defined handler arithmetic operations in the class Calculator , named as opAdd (), opSubtract (), opMultiply (), opDivide (). Then realize the effect of human-computer interaction , 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))
程序及注释
首先定义具有计算功能的类Calculator。在类Calculator中定义处理加减乘除运算的函数,分别命名为opAdd (),opSubtract(),opMultiply(),opDivide()。然后实现人机交互效果,要先定义实现用户界面类CalculatorGUI。通过Panel类的setLayout()函数进行用户界面的布局。此外,要通过actionPerformed(ActionEvent event))函数来实现对按钮事件的监听,并根据不同的按钮事件进行不同的运算。最后实现用户界面类与处理运算类的融合.,所以要在用户界面类(CalculatorGUI)中定义处理运算类(Calculator)的对象,这样,就完成了计算器的功能-Making use of Java calculator examples for learning Java source code download . Use of technology Java2 graphical interface and message response technology . Graphical interface technology , making the user interface of the calculator . By message response technology, features in response to user actions , and ultimately human-computer interaction . JAVA knowledge points used are: window layout is GridLayout applications for the button to listen and respond to the message .
Procedures and Notes
First class definition Calculator with calculating functions . Defined handler arithmetic operations in the class Calculator , named as opAdd (), opSubtract (), opMultiply (), opDivide (). Then realize the effect of human-computer interaction , 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))
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Java计算器\Calculator.class
..........\Calculator.java
..........\CalculatorGUI.class
..........\CalculatorGUI.java
..........\_desktop.ini
..........\计算器.doc
Java计算器