0% found this document useful (0 votes)
90 views

Actividad 1

The document contains code for a Java application that performs basic mathematical operations. It defines functions to reset the input fields, perform calculations when the "Calculate" button is clicked, and close the application when the "Finish" button is clicked. The calculations take numeric input from two text fields, convert them to integers, perform addition, subtraction, multiplication and division, and output the results to other text fields.

Uploaded by

Alex Usurin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

Actividad 1

The document contains code for a Java application that performs basic mathematical operations. It defines functions to reset the input fields, perform calculations when the "Calculate" button is clicked, and close the application when the "Finish" button is clicked. The calculations take numeric input from two text fields, convert them to integers, perform addition, subtraction, multiplication and division, and output the results to other text fields.

Uploaded by

Alex Usurin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy