You are on page 1of 3

private void BNuevoActionPerformed(java.awt.event.

ActionEvent evt) {
// TODO add your handling code here:

//Reinicializar los objetos en blanco

Valor1.setText("");
Valor2.setText("");
Suma.setText("");
Resta.setText("");
Multiplicación.setText("");
División.setText("");

//Colocar el cursos en el Valor1


Valor1.requestFocus();

private void BCalcularActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:

// Declaración de Variables
int suma,resta,multiplicacion,division,valor1,valor2;

// Conversión de datos leidos a numeros


valor1 = Integer.parseInt(Valor1.getText());
valor2 = Integer.parseInt(Valor2.getText());

// Cálculos de las operaciones básicas


suma = valor1 + valor2;
resta = valor1 - valor2;
multiplicacion = valor1 * valor2;
division = valor1 / valor2;

// Salida
Suma.setText(String.valueOf(suma));
Resta.setText(String.valueOf(resta));
Multiplicación.setText(String.valueOf(multiplicacion));
División.setText(String.valueOf(division));

// Enfocamos el cursor al objeto BNuevo


BNuevo.requestFocus();

private void BFinalizarActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
this.dispose();
//System.exit(0);
}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the
default look and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Operaciones.class.getName()).log(java.util.loggi
ng.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Operaciones.class.getName()).log(java.util.loggi
ng.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Operaciones.class.getName()).log(java.util.loggi
ng.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Operaciones.class.getName()).log(java.util.loggi
ng.Level.SEVERE, null, ex);
}
//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Operaciones().setVisible(true);
}
});
}

// Variables declaration - do not modify


private javax.swing.JButton BCalcular;
private javax.swing.JButton BFinalizar;
private javax.swing.JButton BNuevo;
private javax.swing.JTextField División;
private javax.swing.JTextField Multiplicación;
private javax.swing.JTextField Resta;
private javax.swing.JTextField Suma;
private javax.swing.JTextField Valor1;
private javax.swing.JTextField Valor2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextArea jTextArea2;
private javax.swing.JTextPane jTextPane1;
private java.awt.Label label1;
// End of variables declaration
}

You might also like