package calculator;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* <p>Title: 我的计数器</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author unascribed
* @version 1.0
*/
public class Frame extends JFrame {
private double num1=0;
private double num2=0;
private String input="";
int oper=0;
private JPanel contentPane;
private BorderLayout borderLayout1 = new BorderLayout();
private JPanel upPanel = new JPanel();
private JLabel jLabel1 = new JLabel();
private JTextField show = new JTextField();
private JPanel jPanel1 = new JPanel();
private GridLayout gridLayout1 = new GridLayout();
private JButton jButton1 = new JButton();
private JButton jButton2 = new JButton();
private JButton jButton3 = new JButton();
private JLabel jLabel2 = new JLabel();
private JButton badd = new JButton();
private JButton bsub = new JButton();
private JButton jButton6 = new JButton();
private JButton jButton7 = new JButton();
private JButton jButton8 = new JButton();
private JLabel jLabel3 = new JLabel();
private JButton bmul = new JButton();
private JButton jButton10 = new JButton();
private JButton jdiv = new JButton();
private JButton jButton12 = new JButton();
private JLabel jLabel4 = new JLabel();
private JButton jButton14 = new JButton();
private JButton bpow = new JButton();
private JButton jequl = new JButton();
private JButton jButton13 = new JButton();
private JButton jButton17 = new JButton();
private JLabel jLabel5 = new JLabel();
public double calculate(int operation, double number1,double number2)
{
double answer =0.0;
switch(operation){
case 1:
answer=number1+number2;
break;
case 2:
answer=number1-number2;
break;
case 3:
answer=number1*number2;