import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.lang.Math.*;
public class Jsq extends JFrame implements ActionListener
{
String preTxt="",curTxt="",preOp="";
boolean isFloat=false,isNum=false,isDce=false;
private JTextField W=new JTextField("0.");
W.setEnabled(false);
W.setHorizontalAlignment(JTextField.RIGHT);
W.setPreferredSize(new Dimension(20,5));
private JButton bk=new JButton("Backapace");
private JButton ce=new JButton("CE");
private JButton c=new JButton("C");
private JButton kong=new JButton("");
private JButton mc=new JButton("MC");
private JButton qi=new JButton("7");
private JButton ba=new JButton("8");
private JButton jiu=new JButton("9");
private JButton chu=new JButton("/");
private JButton kf=new JButton("sqrt");
private JButton mr=new JButton("MR");
private JButton si=new JButton("4");
private JButton wu=new JButton("5");
private JButton liu=new JButton("6");
private JButton cheng=new JButton("*");
private JButton yu=new JButton("%");
private JButton ms=new JButton("MS");
private JButton yi=new JButton("1");
private JButton er=new JButton("2");
private JButton san=new JButton("3");
private JButton jian=new JButton("-");
private JButton ds=new JButton("1/x");
private JButton mj=new JButton("M+");
private JButton ling=new JButton("0");
private JButton jhj=new JButton("+/-");
private JButton dian=new JButton(".");
private JButton add=new JButton("+");
private JButton dy=new JButton("=");
private JMenuItem editcopy=new JMenuItem("复制(C) ctrl+c");
private JMenuItem editpaste=new JMenuItem("粘贴(P) ctrl+v");
private JMenuItem lookBZ=new JMenuItem("标准性(T)");
private JMenuItem lookKX=new JMenuItem("科学型(s)");
private JMenuItem lookFZ=new JMenuItem("科学分组(I)");
private JMenuItem helpZT=new JMenuItem("帮助主题(H)");
private JMenuItem helpGY=new JMenuItem("关于帮助主题(A)");
//W.setEditable(false);
private class WindowCloser extends WindowAdapter{
public void windowClosing(WindowEvent we){
System.exit(0);
}
}
public Jsq()
{
super("计算器");
JMenu edit=new JMenu("编辑(E)");
edit.add(editcopy); editcopy.setEnabled(true);
edit.add(editpaste);editpaste.setEnabled(true);
JMenu look=new JMenu("查看(V)");
look.add(lookBZ);lookBZ.setEnabled(true);
look.add(lookKX);lookKX.setEnabled(true);
look.addSeparator();
look.add(lookFZ);lookFZ.setEnabled(true);
JMenu help=new JMenu("帮助(H)");
help.add(helpZT);helpZT.setEnabled(true);
help.addSeparator();
help.add(helpGY);helpGY.setEnabled(true);
JMenuBar bar=new JMenuBar();
bar.add(edit);bar.add(look);
bar.add(help);
setJMenuBar(bar);
//bk.addActionListener(this);ce.addActionListener(this);
c.addActionListener(this);//mr.addActionListener(this);
ling.addActionListener(this);//ms.addActionListener(this);
yi.addActionListener(this);//mj.addActionListener(this);
er.addActionListener(this);kf.addActionListener(this);
san.addActionListener(this);cheng.addActionListener(this);
si.addActionListener(this);yu.addActionListener(this);
wu.addActionListener(this);//ds.addActionListener(this);
liu.addActionListener(this);add.addActionListener(this);
qi.addActionListener(this);dy.addActionListener(this);
ba.addActionListener(this);chu.addActionListener(this);