jisuan.javaimportjavax.swing.JMenuBar;publicclassjisuan{publicstaticvoidmain(String[]args){jisqji=newjisq();}}jisq.javaimportjava.awt.Color;importjava.awt.Component;importjava.awt.Font;importjava.awt.event.ActionEvent;importjava.awt.event.ActionListener;importjava.io.BufferedReader;importjava.io.BufferedWriter;importjava.io.File;importjava.io.FileWriter;importjava.io.IOException;importjava.io.StringReader;importjava.text.SimpleDateFormat;importjava.util.*;importjavax.swing.*;importjavax.swing.border.BevelBorder;importjavax.swing.border.SoftBevelBorder;publicclassjisqextendsJFrameimplementsActionListener{JPanelpane=newJPanel();Strings,s1,s2;doublet1,t2,t=0;JTextFieldfiel,show;JTextAreaarea;JButtonb0,b1,b2,add,b3,b4,b5,b6,b7,b8,sub,b9,mul,dele,equ,dev;JButtonsqrt,pow,random,sin,p,log,zf,tui,save,clear,copy,point;publicjisq(){init();this.setBounds(123,143,500,330);this.setTitle(计算器);this.setVisible(true);this.setResizable(false);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);Menumenu=newMenu();this.setJMenuBar(menu);}voidinit(){JLabeldangqian=newJLabel();pane.setLayout(null);this.add(pane);Datenow=newDate();dangqian.setText(now.toString());SimpleDateFormatri=newSimpleDateFormat(dd);//封装为了获取日期SimpleDateFormatshi=newSimpleDateFormat(kk);//封装为了获取小时SimpleDateFormatfen=newSimpleDateFormat(mm);//封装为了获取分钟SimpleDateFormatmiao=newSimpleDateFormat(ss);//封装为了获取秒钟intriqi=Integer.parseInt(ri.format(now));//获取日期intshizhong=Integer.parseInt(shi.format(now));//获取小时intfenzhong=Integer.parseInt(fen.format(now));//获取分钟intmiaozhong=Integer.parseInt(miao.format(now));//获取秒钟dangqian.setBounds(170,7,553,22);pane.add(dangqian);area=newJTextArea();JScrollPanescrollPane=newJScrollPane(area,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);scrollPane.setBounds(280,70,200,140);area.setEditable(false);pane.add(scrollPane);fiel=newJTextField();fiel.setBounds(10,30,250,30);fiel.setEditable(false);fiel.setFont(newFont(TimesRoman,Font.BOLD,16));//显示框中的数字大小和颜色fiel.setHorizontalAlignment(JTextField.RIGHT);//文字右对齐fiel.setBackground(Color.white);//设置背景颜色//fiel.setBorder(newSoftBevelBorder(BevelBorder.LOWERED));pane.add(fiel);show=newJTextField();show.setBounds(280,30,200,30);show.setEditable(false);show.setFont(newFont(TimesRoman,Font.BOLD,16));//显示框中的数字大小和颜色show.setHorizontalAlignment(JTextField.CENTER);//文字居中show.setBackground(Color.gray);//设置背景颜色pane.add(show);b0=newJButton(0);b0.setBounds(10,70,43,33);pane.add(b0);b0.addActionListener(newActionListener(){//匿名类实例做监视器publicvoidactionPerformed(ActionEvente){if(e.getSource()==b0){fiel.setText(fiel.getText()+0);show.setText(fiel.getText());}}});b1=newJButton(1);b1.setBounds(59,70,43,33);pane.add(b1);b1.addActionListener(this);b2=newJButton(2);b2.setBounds(108,70,43,33);pane.add(b2);b2.addActionListener(this);add=newJButton(+);add.setForeground(Color.BLUE);add.setBounds(157,70,43,33);pane.add(add);add.addActionListener(this);b3=newJButton(3);b3.setBounds(10,109,43,33);pane.add(b3);b3.addActionListener(this);b4=newJButton(4);b4.setBounds(59,109,43,33);pane.add(b4);b4.addActionListener(this);b5=newJButton(5);b5.setBounds(108,109,43,33);pane.add(b5);b5.addActionListener(this);sub=newJButton(-);sub.setForeground(Color.BLUE);sub.setBounds(157,109,43,33);pane.add(sub);sub.addActionListener(this);b6=newJButton(6);b6.setBounds(10,148,43,33);pane.add(b6);b6.addActionListener(this);b7=newJButton(7);b7.setBounds(59,148,43,33);pane.add(b7);b7.addActionListener(this);b8=newJButton(8);b8.setBounds(108,148,43,33);pane.add(b8);b8.addActionListener(this);mul=newJButton(*);mul.setForeground(Color.BLUE);mul.setBounds(157,148,43,33);pane.add(mul);mul.addActionListener(this);b9=newJButton(9);b9.setBounds(10,187,43,33);pane.add(b9);b9.addActionListener(this);dele=newJButton(C);dele.setForeground(Color.red);dele.setBounds(59,187,43,33);pane.add(dele);dele.addActionListener(this);equ=newJButton(=);equ.setBounds(108,187,43,33);pane.add(equ);equ.addActionListener(this);dev=newJButton(/);dev.setForeground(Color.blue);dev.setBounds(157,187,43,33);pane.add(dev);dev.addActionListener(this);point=newJButton(.);point.setBounds(10,226,43,33);pane.add(point);point.addActionListener(this);p=newJButton(π);p.setBounds(59,226,43,33);pane.add(p);p.addActionListener(this);zf=newJButton(±);zf.setBounds(108,226,43,33);pane.add(zf);zf.addActionListener(this);tui=newJButton(←);tui.setBounds(206,70,53,33);pane.add(tui);tui.addActionListener(this);sqrt=newJButton(√);sqrt.setBounds(206,148,53,33);pane.add(sqrt);sqrt.addActionListener(this);pow=newJButton(xy);pow.setBounds(206,109,53,33);pane.add(pow);pow.addActionListener(this);random=newJButton(R);random.setBounds(156,226,43,33);pane.add(random);random.addActionListener(this);sin=newJButton(sin);sin.setBounds(206,187,53,33);pane.add(sin);sin.addActionListener(this);log=newJButton(log);log.setBounds(206,226,53,33);pane.add(log);log.addActionListener(this);save=newJButton(保存);save.setForeground(Color.RED);save.setBounds(280,220,60,42);pane.add(save);save.a