Ver Mensaje Individual
  #5 (permalink)  
Antiguo 17/07/2003, 10:29
Avatar de RsOfT
RsOfT
 
Fecha de Ingreso: marzo-2002
Ubicación: InterNET
Mensajes: 1.121
Antigüedad: 22 años, 1 mes
Puntos: 7
Muy bien, pero sabes donde estuvo mi error? en una simple A.
puse ActionPerformed y era actionPerformed, tu si lo escribiste bien... ...

Aqui te dejo mi codiguito terminado...
Código:
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*; //Incluida para que maneje eventos

public class COMPONENTES extends Applet implements ActionListener
{
    public Button bSumar;
    public TextField txtEnt1, txtEnt2;
    public Label lblEnt1, lblEnt2;
    public double Total, Ope1, Ope2;
    
    public void init(){
        lblEnt1 = new Label("Primer Numero: ");
        txtEnt1 = new TextField(10);
        
        lblEnt2 = new Label("Segundo Numero: ");
        txtEnt2 = new TextField(10);
        
        bSumar = new Button("Sumar");
        
        add(lblEnt1);
        add(txtEnt1);
        
        add(lblEnt2);
        add(txtEnt2);
        
        add(bSumar);
        
        bSumar.addActionListener(this);
    }
    
    public void actionPerformed(ActionEvent ev){
        try{
            Ope1 = Double.parseDouble(txtEnt1.getText());
            Ope2 = Double.parseDouble(txtEnt2.getText());
            Total = Ope1 + Ope2;
            showStatus("Resultado: -> "+ Double.toString(Total));
        }
        catch(Exception e){
            showStatus("No se puedo realizar la suma...");
        }
    }
}
__________________
.::RsOfT::.
--El que se aferra a lo conocido, nunca conocerá lo desconocido--
--Es intentando lo imposible como se realiza lo posible--
--Es de pésimo gusto contentarse con algo mediocre cuando lo excelente está a nuestro alcance--