科学计算器源代码.docxVIP

  1. 1、本文档共17页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  5. 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  6. 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  7. 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  8. 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
科学计算器源代码

import java.awt.*;import java.awt.event.*;import javax.swing.*;import java.math.*;class Calculator{GridLayout l1;GridLayout l2;BorderLayout l3;Frame f;Panel p1,p2;JTextField t1;TextField t2;JButton b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20;StringBuffer str;double x, y;int z;static double m;public Calculator(){f = new Frame(吴佳宸);f.setBounds(300,100,600,500);l1 = new GridLayout(1,5, 5, 5);l2 = new GridLayout(4,5,5,5);l3 = new BorderLayout();p1 = new Panel();p2 = new Panel();t1 = new JTextField(27);t1.setHorizontalAlignment(JTextField.RIGHT);t1.setEnabled(true);t1.setText(0);t2 = new TextField();t2.setEnabled(false);b1 = new JButton(7);b1.setForeground(Color.black);b2 = new JButton(8);b2.setForeground(Color.black);b3 = new JButton(9);b3.setForeground(Color.black);b4 = new JButton(/);b4.setForeground(Color.blue);b5 = new JButton(x!);b5.setForeground(Color.blue);b6 = new JButton(4);b6.setForeground(Color.black);b7 = new JButton(5);b7.setForeground(Color.black);b8 = new JButton(6);b8.setForeground(Color.black);b9 = new JButton(*);b9.setForeground(Color.blue);b10 = new JButton(x^y);b10.setForeground(Color.blue);b11 = new JButton(1);b11.setForeground(Color.black);b12 = new JButton(2);b12.setForeground(Color.black);b13 = new JButton(3);b13.setForeground(Color.black);b14 = new JButton(-);b14.setForeground(Color.blue);b15 = new JButton(C);b15.setForeground(Color.red);b16 = new JButton(0);b16.setForeground(Color.black);b17 = new JButton(sin);b17.setForeground(Color.pink);b18 = new JButton(cos);b18.setForeground(Color.pink);b19 = new JButton(+);b19.setForeground(Color.blue);b20 = new JButton(=);b20.setForeground(Color.green);str = new StringBuffer();p1.add(t1);p1.setBounds(10,25,300,45);p1.setLayout(l1);p2.setLayout(l2);p2.add(b1);p2.add(b2);p2.add(b3);p2.add(b4);p2.add(b5);p2.add(b6);p2.add(b7);p2.add(b8);p2.add(b9);p2.add(b10);p2.add(b11);p2.add(b12);p2.add(b13);p2.add(b14);p2.add(b15);p2.add(b16);p2.add(b17);p2.add(b18);p2.add(b

文档评论(0)

jdy261842 + 关注
实名认证
文档贡献者

分享好文档!

1亿VIP精品文档

相关文档