package edu.hpu.yyf;import java.awt.*;import java.awt.event.*;public class MyCalculator { private static double d1 = 0.0;private static double d2 = 0.0;private static String s1 = new String("0");private static String s2 = new String("0");private static char c1 ='0'...
import java.io.*;public class CalculatorWindow extends JFrame implements ActionListener{ NumberButton numberButton[];OperationButton operationButton[];JButton 小数点操作,正负号操作,退格操作,等号操作,清零操作,sin;JTextField resultShow; //显示计算结果 JTextField showComputerProcess; //显示当...
class Calculator extends WindowAdapter implements ActionListener//创建Calculator类, 实现ActionListener接口.{ //result代表上一次运算结果;data1代表当前文本框内显示的数,radixPointDepth代表小数位数 private double result=0,data1=0,radixPointDepth=3;//resultIndicate 代表是否敲击了等号,要求结果 /...
1、题目:计算器。设计内容是设计一个图形界面(GUI)的计算器应用程序,完成简单的算术运算。设计要求是设计的计算器应用程序可以完成家法、减法、乘法、除法和取余运算。且有小数点、正负号、求倒数、退格和清零功能。2、代码:数字按钮NumberButton类如下:import java.awt.import java.awt.event.import...
} private void initComponents() { jPanel1 = new javax.swing.JPanel();jLabel1 = new javax.swing.JLabel();jLabel2 = new javax.swing.JLabel();jLabel3 = new javax.swing.JLabel();num1 = new javax.swing.JTextField();num2 = new javax.swing.JTextField();result = new javax...