import java.awt.FlowLayout;
import javax.swing.*;
public class calc_97_lvl {
calc_97_lvl() {
ListenCalc LC=new ListenCalc();
jfrm.setSize(185,157);
jfrm.
setDefaultCloseOperation(JFrame.
EXIT_ON_CLOSE); jfrm.setVisible(true);
jlab.setText("egeherjrj!");
jlab.setSize(150, 150);
but1.addActionListener(LC);
but2.addActionListener(LC);
but3.addActionListener(LC);
but4.addActionListener(LC);
but5.addActionListener(LC);
but6.addActionListener(LC);
but7.addActionListener(LC);
b1.addActionListener(LC);
b2.addActionListener(LC);
b3.addActionListener(LC);
b4.addActionListener(LC);
b5.addActionListener(LC);
b6.addActionListener(LC);
b7.addActionListener(LC);
b8.addActionListener(LC);
b9.addActionListener(LC);
b0.addActionListener(LC);
jfrm.add(jlab);
jfrm.add(b1);
jfrm.add(b2);
jfrm.add(b3);
jfrm.add(but1);
jfrm.add(b4);
jfrm.add(b5);
jfrm.add(b6);
jfrm.add(but2);
jfrm.add(b7);
jfrm.add(b8);
jfrm.add(b9);
jfrm.add(but3);
jfrm.add(but5);
jfrm.add(b0);
jfrm.add(but6);
jfrm.add(but7);
}
public void set_jlab
(String newText
){jlab.
setText(newText
);} public static void main
(String[] args
){ public void run(){
new calc_97_lvl();
}
});
}}
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.StringTokenizer;
double numberResult;
resultGiver(ae.getActionCommand());
}
public double resultGiver
(String textResult
){
double op1
=Double.
parseDouble(s1
); double op2
=Double.
parseDouble(s3
); if(s2.equals("+")){numberResult=op1+op2;}
else if(s2.equals("-")){numberResult=op1-op2;}
else if(s2.equals("*")){numberResult=op1*op2;}
else if(s2.equals("/")){numberResult=op1/op2;}
else{}
return 0;
}
}