martes, 12 de enero de 2010

Calculadora en java

Main. java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package trabajo;

/**
*
* @author program
*/
public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}

}

Operaciones.java

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/**
*
* @author program
*/
public class Operaciones {

static double resultado;
public Operaciones(){
resultado = 0;
}

public static double seno(double x){
resultado = Math.sin(x);
return resultado;
}

public static double coseno(double x){
resultado = Math.cos(x);
return resultado;
}

public static double tangente(double x){
resultado = Math.tan(x);
return resultado;
}

public static double logaritmo(double x){
if(x==0){
System.out.println("ERROR");
resultado = 0;
}else{
resultado = Math.log(x);
}
return resultado;
}

public static double raiz(double x){
if(x>=0){
resultado = Math.sqrt(x);
}else{
System.out.println("ERROR");
resultado = 0;
}
return resultado;

}

public static double suma(double x, double y){

resultado = x+y;
return resultado;
}

public static double resta(double x, double y){

resultado = x-y;
return resultado;
}

public static double multiplicacion(double x, double y){
resultado = x*y;
return resultado;
}

public static double division(double x, double y){
resultado = x/y;
return resultado;
}

}

Calculadora. java (Applet)

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

/*
* Calculadora.java
*
* Created on 12-ene-2010, 16:23:35
*/

/**
*
* @author program
*/
public class Calculadora extends javax.swing.JApplet {

/** Initializes the applet Calculadora */
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}

/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {

jScrollPane1 = new javax.swing.JScrollPane();
jPanel1 = new javax.swing.JPanel();
jInternalFrame1 = new javax.swing.JInternalFrame();
jTextField1 = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jButton5 = new javax.swing.JButton();
jButton6 = new javax.swing.JButton();
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
jButton9 = new javax.swing.JButton();
jButton10 = new javax.swing.JButton();
jButton11 = new javax.swing.JButton();
jButton12 = new javax.swing.JButton();
jButton13 = new javax.swing.JButton();
jButton15 = new javax.swing.JButton();
jButton14 = new javax.swing.JButton();
jButton16 = new javax.swing.JButton();
jButton17 = new javax.swing.JButton();
jButton18 = new javax.swing.JButton();
jButton19 = new javax.swing.JButton();
jButton20 = new javax.swing.JButton();
jButton21 = new javax.swing.JButton();
jButton22 = new javax.swing.JButton();

jInternalFrame1.setVisible(true);

javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 512, Short.MAX_VALUE)
);
jInternalFrame1Layout.setVerticalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);

jButton1.setText("7");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jButton2.setText("4");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

jButton3.setText("1");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});

jButton4.setText("8");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});

jButton5.setText("5");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});

jButton6.setText("2");
jButton6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
}
});

jButton7.setText("9");
jButton7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}
});

jButton8.setText("6");
jButton8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton8ActionPerformed(evt);
}
});

jButton9.setText("3");
jButton9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
}
});

jButton10.setText("0");
jButton10.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton10ActionPerformed(evt);
}
});

jButton11.setText(".");
jButton11.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton11ActionPerformed(evt);
}
});

jButton12.setText("+");
jButton12.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton12ActionPerformed(evt);
}
});

jButton13.setText("-");
jButton13.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton13ActionPerformed(evt);
}
});

jButton15.setText("/");
jButton15.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton15ActionPerformed(evt);
}
});

jButton14.setText("*");
jButton14.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton14ActionPerformed(evt);
}
});

jButton16.setText("Sen");
jButton16.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton16ActionPerformed(evt);
}
});

jButton17.setText("Cos");
jButton17.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton17ActionPerformed(evt);
}
});

jButton18.setText("Tan");
jButton18.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton18ActionPerformed(evt);
}
});

jButton19.setText("Log");
jButton19.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton19ActionPerformed(evt);
}
});

jButton20.setText("Raiz");
jButton20.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton20ActionPerformed(evt);
}
});

jButton21.setText("Exp");
jButton21.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton21ActionPerformed(evt);
}
});

jButton22.setText("CE");
jButton22.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton22ActionPerformed(evt);
}
});

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jInternalFrame1)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 498, Short.MAX_VALUE)
.addGap(10, 10, 10))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton6))
.addComponent(jButton10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton14, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE)
.addComponent(jButton15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton12)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton18, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jButton22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(126, 126, 126))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton4)
.addComponent(jButton7)
.addComponent(jButton12)
.addComponent(jButton16)
.addComponent(jButton20))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton2)
.addComponent(jButton5)
.addComponent(jButton8)
.addComponent(jButton13)
.addComponent(jButton17)
.addComponent(jButton21))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(jButton6)
.addComponent(jButton9)
.addComponent(jButton14)
.addComponent(jButton18)
.addComponent(jButton22))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton10)
.addComponent(jButton11)
.addComponent(jButton15)
.addComponent(jButton19))
.addContainerGap(104, Short.MAX_VALUE))
);

jScrollPane1.setViewportView(jPanel1);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
);
}//


private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
aux += ".";
jTextField1.setText(aux);
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "7";
jTextField1.setText(aux);
}
else{
aux += 7;
jTextField1.setText(aux);
}


}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

if(aux =="0")
{
aux= "4";
jTextField1.setText(aux);
}
else{
aux += 4;
jTextField1.setText(aux);
}

}

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "1";
jTextField1.setText(aux);
}
else{
aux += 1;
jTextField1.setText(aux);
}
}

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "8";
jTextField1.setText(aux);
}
else{
aux += 8;
jTextField1.setText(aux);
}
}

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "5";
jTextField1.setText(aux);
}
else{
aux += 5;
jTextField1.setText(aux);
}
}

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "2";
jTextField1.setText(aux);
}
else{
aux += 2;
jTextField1.setText(aux);
}
}

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "9";
jTextField1.setText(aux);
}
else{
aux += 9;
jTextField1.setText(aux);
}
}

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "6";
jTextField1.setText(aux);
}
else{
aux += 6;
jTextField1.setText(aux);
}
}

private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "3";
jTextField1.setText(aux);
}
else{
aux += 3;
jTextField1.setText(aux);
}

}

private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(aux =="0")
{
aux= "0";
jTextField1.setText(aux);
}
else{
aux += 0;
jTextField1.setText(aux);
}
}

private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
String aux3 = jTextField1.getText();
double y = Double.parseDouble(aux1);
double x = Double.parseDouble(aux3);
aux = "";
jTextField1.setText(aux+(Operaciones.suma(x, y)));
aux = "";


}

private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
String aux3 = jTextField1.getText();
double y = Double.parseDouble(aux1);
double x = Double.parseDouble(aux3);
aux = "";
jTextField1.setText(aux+(Operaciones.resta(x, y)));
aux = "";
}

private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
String aux3 = jTextField1.getText();
double y = Double.parseDouble(aux1);
double x = Double.parseDouble(aux3);
aux = "";
jTextField1.setText(aux+(Operaciones.multiplicacion(x, y)));
aux = "";
}

private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
String aux3 = jTextField1.getText();
double y = Double.parseDouble(aux1);
double x = Double.parseDouble(aux3);
aux = "";
jTextField1.setText(aux+(Operaciones.division(x, y)));
aux = "";
}

private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.seno(r);
aux = "";
jTextField1.setText(aux + r);
}

private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.coseno(r);
aux = "";
jTextField1.setText(aux + r);
}

private void jButton18ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.tangente(r);
aux = "";
jTextField1.setText(aux + r);
}

private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.logaritmo(r);
aux = "";
jTextField1.setText(aux + r);
}

private void jButton20ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.raiz(r);
aux = "";
jTextField1.setText(aux + r);

}

private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String aux1 = jTextField1.getText();
double r = Double.parseDouble(aux1);
r = Operaciones.raiz(r);
aux = "";
jTextField1.setText(aux + r);

}

private void jButton22ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
aux = "0";
jTextField1.setText(aux);
}
public String aux="";
public String aux2="";

// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton10;
private javax.swing.JButton jButton11;
private javax.swing.JButton jButton12;
private javax.swing.JButton jButton13;
private javax.swing.JButton jButton14;
private javax.swing.JButton jButton15;
private javax.swing.JButton jButton16;
private javax.swing.JButton jButton17;
private javax.swing.JButton jButton18;
private javax.swing.JButton jButton19;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton20;
private javax.swing.JButton jButton21;
private javax.swing.JButton jButton22;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6;
private javax.swing.JButton jButton7;
private javax.swing.JButton jButton8;
private javax.swing.JButton jButton9;
private javax.swing.JInternalFrame jInternalFrame1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextField jTextField1;
// End of variables declaration

}

1 comentario:

  1. Que fue ve te falta un boton que te de los resultados es decir un igual; yo lo tengo así:

    private void jButton22ActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:
    if(aux2=="+"){
    String aux1 = jTextField1.getText();
    double r = Double.parseDouble(aux1);
    r = Operaciones.suma(r);
    jTextField1.setText(""+r);
    }
    if(aux2=="-"){
    String aux1 = jTextField1.getText();
    double r = Double.parseDouble(aux1);
    r = Operaciones.resta(r);
    jTextField1.setText(""+r);
    }
    if(aux2=="*"){
    String aux1 = jTextField1.getText();
    double r = Double.parseDouble(aux1);
    r = Operaciones.multiplicacion(r);
    jTextField1.setText(""+r);
    }
    if(aux2=="/"){
    String aux1 = jTextField1.getText();
    double r = Double.parseDouble(aux1);
    r = Operaciones.division(r);
    jTextField1.setText(""+r);
    }
    if(aux2=="p"){
    String aux1 = jTextField1.getText();
    double r = Double.parseDouble(aux1);
    r = Operaciones.exponente(r);
    jTextField1.setText(""+r);
    }

    ResponderEliminar