@Override
public void actionPerformed(ActionEvent e) {
if(s1.equals("0")) s1="9";
else {text.setText(s1+"9");
s1+="9";}
text.setText(s1);
}
});
four.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(s1.equals("0")) s1="4";
else {text.setText(s1+"4");
s1+="4";}
text.setText(s1);
}
});
five.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(s1.equals("0")) s1="5";
else {text.setText(s1+"5");
s1+="5";}
text.setText(s1);
}
});
six.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(s1.equals("0")) s1="6";
else {text.setText(s1+"6");
s1+="6";}
text.setText(s1);
}
});
one.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(s1.equals("0")) s1="1";
else {text.setText(s1+"1");
s1+="1";}
text.setText(s1);
}
});
two.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(s1.equals("0")) s1="2";
else {text.setText(s1+"2");
s1+="2";}
text.setText(s1);
}
});
three.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(s1.equals("0")) s1="3";
else {text.setText(s1+"3");
s1+="3";}
text.setText(s1);
}
});
zero.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(!s1.equals("0")) s1+="0";
text.setText(s1);
}
});
but.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(c1=='0') {d1=Double.parseDouble(s1);if(d1!=0){c1 = '/';}}
else {d2=Double.parseDouble(s1);
judgec1(text);
c1 = '/';}
s1="0";
}
});
substract.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(c1=='0') {d1=Double.parseDouble(s1);if(d1!=0){c1 = '-';}}
else {d2=Double.parseDouble(s1);
judgec1(text);
c1 = '-';}
s1="0";
}
});
ride.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(c1=='0') {d1=Double.parseDouble(s1);if(d1!=0){c1 = '*';}}
else {d2=Double.parseDouble(s1);
judgec1(text);
c1 = '*';}
s1="0";
}
});
add.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(c1=='0') {d1=Double.parseDouble(s1);if(d1!=0){c1 = '+';}}
else {d2=Double.parseDouble(s1);
judgec1(text);
c1 = '+';}
s1="0";
}
});
/* Backspace.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(s1.length()!=0){
if(c1=='0') {text.setText(s1.substring(0, s1.length()-1));s1=s1.substring(0, s1.length()-1);}
else if (c1!='0'!s2.equals("0")) {text.setText(s2.substring(0, s1.length()-1));s2=s2.substring(0, s2.length()-1);}
}}
});*/
equal.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
if(c1=='0') d1=Double.parseDouble(s1);
else {d2=Double.parseDouble(s1);
judgec1(text);}
s1="0";
c1='0';
}
});
cclt.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
((Frame) e.getComponent()).dispose();
}
});
cclt.setResizable(false);
cclt.setVisible(true);
}
}
我们老师写的哦
求JAVA源代码我用了半个小时 帮java经典源代码大全你写了一个简单的验证用户名和密码登陆问题 别辜负我的好意下面是代码!(建好包和类 代码粘过去就能用)
推荐阅读
- python可以做窗体程序吗,python程序做成窗口
- js获取当前浏览器上下宽度,js获取浏览器的高度
- 服务器换域名,服务器换域名会怎么样
- 怎么看导航是几核的显卡,怎么看导航是几核的显卡型号
- php游戏数据平台 php游戏服务器
- 电脑怎么给荣耀50传照片,电脑怎么给荣耀50传照片到手机
- cpu为什么这么难,cpu为什么这么耐用
- 虎牙直播坐骑虎宝宝进化,虎牙开通坐骑主播有提成吗
- c语言随机函数出不同的数 c语言中,产生随机数的函数及其应用代码举例