3.TALLER DE PROGRAMACIÓN
PROGRAMA QUE DETERMINA SI UNA PESO DEBE HACER EJERCICIO PARA MEJORAR SU PESO
PROGRAMA QUE DETERMINA SI UNA PESO DEBE HACER EJERCICIO PARA MEJORAR SU PESO
1. CÓDIGO FUENTE (NETBEANS)
package paqPeso;
import javax.swing.JOptionPane;
/**
*
* @author FAMILIA ARIZA
*/
public class jPeso extends javax.swing.JFrame {
/**
* Creates new form jPeso
*/
public jPeso() {
initComponents();
JOptionPane.showMessageDialog(null, "******BIENVENIDO******");
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
JBtnenviar = new javax.swing.JButton();
jTxt = new javax.swing.JTextField();
jLbl = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
JBtnenviar.setText("ENVIAR");
JBtnenviar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JBtnenviarActionPerformed(evt);
}
});
jLbl.setText("INGRESE SU PESO POR FAVOR.......¡¡");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(103, 103, 103)
.addComponent(jLbl, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(151, 151, 151)
.addComponent(JBtnenviar, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(160, 160, 160)
.addComponent(jTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(39, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(jLbl, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(30, 30, 30)
.addComponent(jTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(42, 42, 42)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(JBtnenviar)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(122, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void JBtnenviarActionPerformed(java.awt.event.ActionEvent evt) {
Integer num=0;
num=Integer.parseInt(jTxt.getText());
if(num>59)
{
JOptionPane.showMessageDialog(null, "DISCULPE PERO NECESITA HACER EJERCICIO");
}
else
{
JOptionPane.showMessageDialog(null, "TIENE UN BUEN PESO, MANTENGASE ASI :)");
}
// TODO add your handling code here:
}
/**
* @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(jPeso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(jPeso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(jPeso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(jPeso.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new jPeso().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton JBtnenviar;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLbl;
private javax.swing.JTextField jTxt;
// End of variables declaration
}
2. COMPRIMIDO DEL PROGRAMA
No hay comentarios:
Publicar un comentario