package areacirculo;
public class FRMAREACIRCULO extends javax.swing.JFrame {
public FRMAREACIRCULO() {
initComponents();
}
pack();
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
double pi=3.14;
int radio;
radio=Integer.parseInt(txtradio.getText());
double area=pi*Math.pow(radio, 2);
txtresultado.setText(String.valueOf(area));
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
txtradio.setText("");
txtresultado.setText("");
txtradio.requestFocus();
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
dispose ();
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
double pi=3.14;
int radio;
radio=Integer.parseInt(txtradio.getText());
double perimetro = 2*radio *pi;
txtresultado.setText(String.valueOf(perimetro));
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FRMAREACIRCULO().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JTextField txtradio;
private javax.swing.JTextField txtresultado;
// End of variables declaration
}
No hay comentarios.:
Publicar un comentario