电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

用java编计算器

用java编计算器_第1页
用java编计算器_第2页
用java编计算器_第3页
import java.applet.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; //import java.math.*; public class cal extends Applet { //定义所有需要使用的全局变量 String str="0";//暂存显示屏数据 String sign="null";//暂存符号数据 double num=0;//暂存内部运算数据 boolean change=false;//暂存内部四则运算起用 GridLayout g0,g1;//定义AWT 布局部件 JTextField number; Button num_p,num_0,num_1,num_2,num_3,num_4,num_5,num_6,num_7,num_8,num_9; Button act_add,act_mul,act_div,act_sub; Button mat_sin,mat_cos,mat_tan; Button do_ans,do_del; Panel p0,p1; public void init()//主程序部分 { //定义各个控件的样式 number=new JTextField(20);//显示屏 number.setHorizontalAlignment(JTextField.RIGHT); number.setEnabled(false); number.setText("0"); num_p=new Button("。");//小数点的按钮 num_p.setForeground(Color.red); num_p.addActionListener(new getbt()); num_0=new Button("0");//数字 0 的按钮 num_0.setForeground(Color.red); num_0.addActionListener(new getbt()); num_1=new Button("1");//数字 1 的按钮 num_1.setForeground(Color.red); num_1.addActionListener(new getbt()); num_2=new Button("2");//数字 2 的按钮 num_2.setForeground(Color.red); num_2.addActionListener(new getbt()); num_3=new Button("3");//数字3 的按钮 num_3.setForeground(Color.red); num_3.addActionListener(new getbt()); num_4=new Button("4");//数字4 的按钮 num_4.setForeground(Color.red); num_4.addActionListener(new getbt()); num_5=new Button("5");//数字5 的按钮 num_5.setForeground(Color.red); num_5.addActionListener(new getbt()); num_6=new Button("6");//数字6 的按钮 num_6.setForeground(Color.red); num_6.addActionListener(new getbt()); num_7=new Button("7");//数字7 的按钮 num_7.setForeground(Color.red); num_7.addActionListener(new getbt()); num_8=new Button("8");//数字8 的按钮 num_8.setForeground(Color.red); num_8.addActionListener(new getbt()); num_9=new Button("9");//数字9 的按钮 num_9.setForeground(Color.red); nu...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部