📄 computer.java
字号:
} }); //可以在文本域中显示帮助内容 A.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "欢迎您使用帮助:J.S.L-计算器可以执行所有手持计算器完成的标准操作;它可以执行基本的运算,如加减乘除法,以及科学计算器中的函数,如三角函数,以e为底的指数和对数函数,还可以进行开方和绝对值运算。"; tt.setText(s); } }); //可以在文本域中显示字母b B.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "b"; tt.setText(s); } }); //可以在文本域中显示字母c C.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "查看源文件请点击最上面的下拉框"; tt.setText(s); } }); //可以在文本域中显示字母d D.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "d"; tt.setText(s); } }); //可以在文本域中显示字母e E.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "e"; tt.setText(s); } }); //可以在文本域中显示字母f F.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "f"; tt.setText(s); } }); //可以在文本域中显示字母g G.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "g"; tt.setText(s); } }); //可以在文本域中显示帮助主题 H.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "欢迎您使用帮助主题:清空可以使用‘CE‘按钮或文件(F)中的清空按钮;复制可以使用按钮‘C(大写)‘或编辑中的复制(C);粘贴可以使用按钮‘P(大写)‘或使用编辑中的粘贴(P);退出可以使用按钮'EXIT'或文件中的退出(EXIT)。(如果您想了解更多的信息请看帮助中的关于计算器(a))!"; tt.setText(s); } }); //可以在文本域中显示字母i I.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "i"; tt.setText(s); } }); //可以在文本域中显示字母j J.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "j"; tt.setText(s); } }); //可以在文本域中显示字母k K.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "k"; tt.setText(s); } }); //可以在文本域中显示字母l L.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "l"; tt.setText(s); } }); //可以在文本域中显示字母m M.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "m"; tt.setText(s); } }); //可以在文本域中显示字母n N.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "n"; tt.setText(s); } }); //可以在文本域中显示字母o O.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "o"; tt.setText(s); } }); //可以在文本域中显示字母p P.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "p"; tt.setText(s); } }); //可以在文本域中显示字母q Q.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "q"; tt.setText(s); } }); //可以在文本域中显示字母r R.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "r"; tt.setText(s); } }); //可以在文本域中显示字母s S.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "s"; tt.setText(s); } }); //可以在文本域中显示字母t T.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "t"; tt.setText(s); } }); //可以在文本域中显示字母u U.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "u"; tt.setText(s); } }); //可以在文本框中显示数字3.1415926 V.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = t.getText(); s += "3.1415926"; t.setText(s); } }); //可以在文本域中显示字母w W.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "w"; tt.setText(s); } }); //可以在文本域中显示字母x X.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "x"; tt.setText(s); } }); //可以在文本域中显示字母y Y.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "y"; tt.setText(s); } }); //可以在文本域中显示字母z Z.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = tt.getText(); s += "z"; tt.setText(s); } });//给复选框添加选项 ch.add(""); ch.add("import java.awt.*;"); ch.add("import java.awt.event.*;"); ch.add("import javax.swing.*;"); ch.add("public class Computer"); ch.add(" extends Frame"); ch.add(" implements ActionListener {"); ch.add(" MenuBar mb = new MenuBar();"); ch.add(" ScrollPane sp = new ScrollPane();"); ch.add(" Panel pp = new Panel();"); ch.add(" Panel p = new Panel();"); ch.add(" Panel p0 = new Panel();"); ch.add(" Panel p1 = new Panel();"); ch.add(" Panel p2 = new Panel();"); ch.add(" Panel p3 = new Panel();"); ch.add(" Panel p4 = new Panel();"); ch.add(" Panel p5 = new Panel();"); ch.add(" Panel p6 = new Panel();"); ch.add(" Panel p7 = new Panel();"); ch.add(" Panel p8 = new Panel();"); ch.add(" Panel p9 = new Panel();"); ch.add(" Button ba = new Button(" + ");"); ch.add(" double u1, u2, u3;"); ch.add(" char op;"); ch.add(" i.addActionListener(this);"); ch.add(" pp.setLayout(new GridLayout(13, 1, 5, 5));"); ch.add(" pp.setBackground(Color.blue);"); ch.add(" t.setForeground(Color.white);"); ch.add(" l.setForeground(Color.green);"); ch.add(" i.setBackground(Color.ORANGE);"); ch.add(" bbb.setBackground(Color.yellow);"); ch.add(" b0.setBackground(Color.red);"); ch.add(" b1.setBackground(Color.GREEN);"); ch.add(" b2.setBackground(Color.ORANGE);"); ch.add(" b3.setBackground(Color.yellow);"); ch.add(" b4.setBackground(Color.green);"); ch.add(" b5.setBackground(Color.orange);"); ch.add(" b6.setBackground(Color.yellow);"); ch.add(" b7.setBackground(Color.red);"); ch.add(" b8.setBackground(Color.YELLOW);"); ch.add(" b9.setBackground(Color.red);"); ch.add(" ba.setBackground(Color.green);"); ch.add(" bb.setBackground(Color.yellow);"); ch.add(" bc.setBackground(Color.red);"); ch.add(" bd.setBackground(Color.green);"); ch.add(" be.setBackground(Color.orange);"); ch.add(" bf.setBackground(Color.pink);"); ch.add(" bg.setBackground(Color.red);"); ch.add(" bh.setBackground(Color.yellow);"); ch.add(" bi.setBackground(Color.green);"); ch.add(" bj.setBackground(Color.orange);"); ch.add(" bk.setBackground(Color.red);"); ch.add(" bl.setBackground(Color.yellow);"); ch.add(" bm.setBackground(Color.green);"); ch.add(" bn.setBackground(Color.orange);"); ch.add(" bo.setBackground(Color.red);"); ch.add(" bp.setBackground(Color.yellow);"); ch.add(" bq.setBackground(Color.green);"); ch.add(" br.setBackground(Color.orange);"); ch.add(" A.setBackground(Color.green);"); ch.add(" B.setBackground(Color.ORANGE);"); ch.add(" C.setBackground(Color.red);"); ch.add(" D.setBackground(Color.yellow);"); ch.add(" E.setBackground(Color.GREEN);"); ch.add(" F.setBackground(Color.red);"); ch.add(" G.setBackground(Color.orange);"); ch.add(" H.setBackground(Color.green);"); ch.add(" I.setBackground(Color.red);"); ch.add(" K.setBackground(Color.orange);"); ch.add("import java.awt.*;"); ch.add("import java.awt.event.*;"); ch.add("import javax.swing.*;"); ch.add("public class Computer"); ch.add(" extends Frame"); ch.add(" implements ActionListener {"); ch.add( " TextArea tt = new TextArea(2, 1);TextArea ttt= new TextArea(1, 1);"); ch.add(" MenuBar mb = new MenuBar();"); ch.add(" ScrollPane sp = new ScrollPane();"); ch.add(" Panel pp = new Panel();"); ch.add(" Panel p = new Panel();"); ch.add(" Panel p0 = new Panel();"); ch.add(" Panel p1 = new Panel();"); ch.add(" Panel p2 = new Panel();"); ch.add(" Panel p3 = new Panel();"); ch.add(" Panel p4 = new Panel();"); ch.add(" Panel p5 = new Panel();"); ch.add(" Panel p6 = new Panel();"); ch.add(" Panel p7 = new Panel();"); ch.add(" Panel p8 = new Panel();"); ch.add(" Panel p9 = new Panel();"); ch.add(" String s1, s2, s3, mem;"); ch.add(" double u1, u2, u3;"); ch.add(" char op;"); ch.add(" public Computer() {"); ch.add(" mm4.addActionListener(this);"); ch.add(" i.addActionListener(this);"); ch.add(" pp.setLayout(new GridLayout(13, 1, 5, 5));"); ch.add(" pp.setBackground(Color.blue);"); ; ch.add(" t.setForeground(Color.white);"); ch.add(" tt.setForeground(Color.red);"); ch.add(" i.setBackground(Color.ORANGE);"); ch.add(" bbb.setBackground(Color.yellow);"); ch.add(" b0.setBackground(Color.red);"); ch.add(" b1.setBackground(Color.GREEN);"); ch.add(" b2.setBackground(Color.ORANGE);"); ch.add(" b3.setBackground(Color.yellow);"); ch.add(" b4.setBackground(Color.green);"); ch.add(" b5.setBackground(Color.orange);"); ch.add(" b6.setBackground(Color.yellow);"); ch.add(" b7.setBackground(Color.red);"); ch.add(" b8.setBackground(Color.YELLOW);"); ch.add(" b9.setBackground(Color.red);"); ch.add(" ba.setBackground(Color.green);"); ch.add(" bb.setBackground(Color.yellow);"); ch.add(" bc.setBackground(Color.red);"); ch.add(" bd.setBackground(Color.green);"); ch.add(" be.setBackground(Color.orange);"); ch.add(" bf.setBackground(Color.pink);"); ch.add(" bg.setBackground(Color.red);"); ch.add(" bh.setBackground(Color.yellow);"); ch.add(" bi.setBackground(Color.green);"); ch.add(" bj.setBackground(Color.orange);"); ch.add(" bk.setBackground(Color.red);"); ch.add(" bl.setBackground(Color.yellow);"); ch.add(" bm.setBackground(Color.green);"); ch.add(" bn.setBackground(Color.orange);"); ch.add(" bo.setBackground(Color.red);"); ch.add(" bp.setBackground(Color.yellow);"); ch.add(" bq.setBackground(Color.green);"); ch.add(" br.setBackground(Color.orange);"); ch.add(" B.setBackground(Color.ORANGE);"); ch.add(" C.setBackground(Color.red);"); ch.add(" D.setBackground(Color.yellow);"); ch.add(" E.setBackground(Color.GREEN);"); ch.add(" F.setBackground(Color.red);"); ch.add(" G.setBackground(Color.orange);"); ch.add(" H.setBackground(Color.green);"); ch.add(" L.setBackground(Color.green);"); ch.add(" M.setBackground(Color.yellow);"); ch.add(" N.setBackground(Color.red);"); ch.add(" O.setBackground(Color.orange);"); ch.add(" P.setBackground(Color.green);"); ch.add(" Q.setBackground(Color.red);"); ch.add(" S.setBackground(Color.orange);"); ch.add(" T.setBackground(Color.red);"); ch.add(" U.setBackground(Color.orange);");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -