Aqui esta el codigo que falto.
public class GUICalculadora extends javax.swing.JFrame {
public GUICalculadora() {
initComponents();
ImplementaCalculadora Clocal;
}
private void initComponents() {
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jTextField3 = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(null);
jButton1.setText("Suma");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(114, 65, 100, 23);
jButton2.setText("Resta");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
getContentPane().add(jButton2);
jButton2.setBounds(112, 106, 100, 23);
getContentPane().add(jTextField1);
jTextField1.setBounds(54, 66, 52, 20);
getContentPane().add(jTextField2);
jTextField2.setBounds(54, 107, 52, 20);
jLabel1.setText("a");
getContentPane().add(jLabel1);
jLabel1.setBounds(30, 69, 10, 14);
jLabel2.setText("b");
getContentPane().add(jLabel2);
jLabel2.setBounds(30, 110, 10, 14);
jLabel3.setText("programa que probablemente suma y resta");
getContentPane().add(jLabel3);
jLabel3.setBounds(30, 21, 400, 14);
jLabel4.setText("Resultado");
getContentPane().add(jLabel4);
jLabel4.setBounds(41, 150, 60, 14);
getContentPane().add(jTextField3);
jTextField3.setBounds(107, 147, 45, 20);
setTitle("que pedo");
pack();
setSize(350,250);
}
//Codigo del boton de suma
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt){
try
{
ImplementaCalculadora Clocal = new ImplementaCalculadora();
jTextField3.setText("" +
Clocal.suma(
Double.parseDouble(jTextField1.getText()),
Double.parseDouble(jTextField2.getText())
));
}
catch (Exception e)
{
}
}
//Codigo del boton de resta
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
try
{
ImplementaCalculadora Clocal = new ImplementaCalculadora();
jTextField3.setText("" +
Clocal.resta(
Double.parseDouble(jTextField1.getText()),
Double.parseDouble(jTextField2.getText())
));
}
catch (Exception e)
{
}
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new GUICalculadora().setVisible(true);
}
});
}
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private int a,b,c;
}
lunes, 4 de abril de 2011
Suscribirse a:
Entradas (Atom)