计算器界面Java编程.doc
上传人:qw****27 上传时间:2024-09-12 格式:DOC 页数:7 大小:56KB 金币:15 举报 版权申诉
预览加载中,请您耐心等待几秒...

计算器界面Java编程.doc

计算器界面Java编程.doc

预览

在线预览结束,喜欢就下载吧,查找使用更方便

15 金币

下载此文档

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

计算机界面Java编程实现结果:代码:importjava.awt.*;importjavax.swing.*;publicclassjisuanqiextendsJFrame{publicjisuanqi(){JPanelp1=newJPanel();p1.setLayout(newGridLayout(5,11));JButtonj1=newJButton("Sta");j1.setBackground(Color.white);j1.setForeground(Color.blue);p1.add(j1);JButtonj2=newJButton("F-E");j2.setBackground(Color.white);j2.setForeground(Color.magenta);p1.add(j2);JButtonj3=newJButton("(");j3.setBackground(Color.white);j3.setForeground(Color.magenta);p1.add(j3);JButtonj4=newJButton(")");j4.setBackground(Color.white);j4.setForeground(Color.magenta);p1.add(j4);JButtonj5=newJButton("MC");j5.setBackground(Color.white);j5.setForeground(Color.red);p1.add(j5);JButtonj6=newJButton("7");j6.setBackground(Color.white);j6.setForeground(Color.blue);p1.add(j6);JButtonj7=newJButton("8");j7.setBackground(Color.white);j7.setForeground(Color.blue);p1.add(j7);JButtonj8=newJButton("9");j8.setBackground(Color.white);j8.setForeground(Color.blue);p1.add(j8);JButtonj9=newJButton("/");j9.setBackground(Color.white);j9.setForeground(Color.red);p1.add(j9);JButtonj10=newJButton("Mod");j10.setBackground(Color.white);j10.setForeground(Color.red);p1.add(j10);JButtonj11=newJButton("And");j11.setBackground(Color.white);j11.setForeground(Color.red);p1.add(j11);JButtonj12=newJButton("Ave");j12.setForeground(Color.darkGray);j12.setEnabled(false);p1.add(j12);JButtonj13=newJButton("dms");j13.setBackground(Color.white);j13.setForeground(Color.magenta);p1.add(j13);JButtonj14=newJButton("Exp");j14.setBackground(Color.white);j14.setForeground(Color.magenta);p1.add(j14);JButtonj15=newJButton("ln");j15.setBackground(Color.white);j15.setForeground(Color.magenta);p1.add(j15);JButtonj16=newJButton("MR");j16.setBackground(Color.white);j16.setForeground(Color.red);p1.add(j16);JButtonj17=newJButton("4");j17.setBa