Buscando código fuente de calculadora simple Java

paquete uno;importar java.awt.Button;

importar java.awt.Component;

importar java.awt.Container;

importar java.awt.Frame;

importar java.awt.GridBagConstraints;

importar java.awt.GridBagLayout;

importar java.awt.Panel ;

importar java.awt.TextField;

importar java.awt.event.ActionEvent;

importar java.awt.event.ActionListener;

importar java.awt.event.WindowAdapter;

importar java.awt.event.WindowEvent;la clase pública ComFrame extiende el marco {

/**

*

*/

privado estático final largo serialVersionUID = 4815962372262243709L;

String valued="",op="",str="789/ 456*123-0.=+";

boolean clicknum=true,start=true;

int s=0;

double arg=0;

Botón btn=null;

TextField txtInput=new TextField(12);

GridBagLayout gbl=new GridBagLayout();

GridBagConstraints gbc=new GridBagConstraints();

Panel pan=new Panel();

componente privado addButton(nombre de cadena, contenedor con){

btn= new Button();

btn.addActionListener(new MyFrameListener());

btn.setLabel(nombre);

con.add(btn);

return btn;

}

private void setGbc(GridBagConstraints gbc,int x,int y,int width,int height,GridBagLayout gbl, Component con) {

gbc.gridx=x;

gbc.gridy=y;

gbc.gridwidth=ancho;

gbc.gridheight =altura;

gbl.setConstraints(con, gbc);

}

public ComFrame(){

this.setTitle( "Formulario informático");

pa

n.setLayout(gbl);

txtInput.setBounds(15, 45, 270, 25);

pan.setBounds(15, 80, 270, 150);

this.setLayout(null);

gbc.fill=GridBagConstraints.BOTH;

gbc.weightx=1.0;

gbc.weighty= 1.0;

this.add(txtInput);

this.add(pan);

for(int i=0;i<4;i++) {

for(int j=0;j<4;j++){

this.setGbc(gbc, j, i, 1, 1, gbl, this.addButton(str .substring(s, ++s), pan));

}

}

this.setGbc(gbc, 0, 4, 2, 1 , gbl, this.addButton("Clear", pan));

this.setGbc(gbc, 2, 4, 2, 1, gbl, this.addButton("Salir", pan));

this.setSize(300, 250);

this.setVisible(true);

this.addWindowListener(new WindowAdapter() {

@Override

ventana vacía públicaClosing(WindowEvent e) {

System.exit(0);

}

} );

}

public static void main(String[] args) {

new ComFrame();

}

clase MyFrameListener implementa ActionListener{

@Override

public void actionPerformed(ActionEvent e) {

// TODO Código auxiliar de método generado automáticamente

if(e.getActionCommand().equals("Borrar")){

}

else if(e.getActionCommand().equals("Salir ")){

System.exit(0);

}else{

Entrada(e.getActionCommand());

}

}

entrada nula privada (valor de cadena){

if(value.equals("+")){

if(arg!=0.0&&clicknum==true&&!op.equals("="))

operación(Double.valueOf(valued));

clicknum=false;

op="+";

}

else if(value.equals("-") ){

if(arg!=0.0&&clicknum==true&&!op.equals("="))

operación(Double.valueOf(valued));

clicknum=false;

op="-";

}

else if(value.equals("*")){

if(arg!=0.0&&clicknum==true&&!op.equals("="))

operación(Double.valueOf(valued));

clicknum =false;

op="*";

}

else if(value.equals("/")){

if(arg!=0.0&&clicknum==true&&!op.equals("="))

operación(Double.valueOf(valued));

clicknum=false;

op="/";

}

else if(value.equals("=")){

if(clicknum ==true&&!op.equals("=")){

operación(Double.valueOf(valued));

}

clicknum=false;

op="=";

start=false;

}

más {

si( op.equals("=")){

arg=0.0;

valorado=valor;

}

if(! op.equals("")&&clicknum==false){

if(arg==0.0&&start==true){

arg=Double.valueOf(valued); p>

}

valued="";

clicknum=true;

start=true;

}

if(value=="."&&valued.contains(".")){

}

else if(value=="."&&valued == ""){

valorado="0.";

}

else{

valorado=valorado+valor;

p>

}

txtInput.setText(va

lued);

}

}

operación de anulación privada (Doble n){

if(op.equals("+" ))arg+=n;

if(op.equals("-"))arg-=n;

if(op.equals("*"))arg*= n;

if(op.equals("/"))arg/=n;

txtInput.setText(""+arg);

}

}

}El diseño del formulario debe estar bien