import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class MathApplet extends Applet implements ActionListener
{
private Label lblPrompt,lblNom1,lblNom2,lblCampur;
private TextField txtNom1,txtNom2;
private Button btnKira; //isytiharkan button
public void init()
{
lblPrompt=new Label("masukkan 2 nombor integer");
lblNom1=new Label("nombor Pertama:");
lblNom2=new Label("nombor kedua:");
txtNom1=new TextField("0");
txtNom2=new TextField("0");
lblCampur=new Label("Hasil campur:0");
btnKira=new Button("Kira");//objek btn kira

setLayout(null);//tidak mengggunakan layout manager
//letakkan obnjek gui di objek
add(lblPrompt);
add(lblNom1);
add(txtNom1);
add(lblNom2);
add(txtNom2);
add(lblCampur);
add(btnKira);
//set kedudukan dan saiz objek GUI
lblPrompt.setBounds(65,20,200,25);
lblNom1.setBounds(100,50,150,25);
txtNom1.setBounds(255,50,50,25);
lblNom2.setBounds(100,80,150,25);
txtNom2.setBounds(255,80,50,25);
btnKira.setBounds(320,80,100,35); // koordinat button
lblCampur.setBounds(100,110,200,25);

//add this applet as action listener
btnKira.addActionListener(this);//peristiwa button

}
public void actionperformed(ActionEvent event)
{ int nom1,nom2,hasilcampur;
//jika pengguna klik button kira
if(event.getSource()==btnKira)
{nom1=Integer.parseInt(txtNom1.getText());
nom2=Integer.parseInt(txtNom2.getText());
hasilcampur=nom1+nom2;
lblCampur.setText("Hasil Campur:"+nom1+"+"+nom2+"="+hasilcampur);
}//tamat if
}//tamat actionPerformed
}//tamat class MathAplet

this ini the coding and detect 1 error on line 4(public class MathApplet extends Applet implements ActionListener
)..anyone can tell how to solve this problem?????

I assume the error says that it does not implement some method or something to that effect, right?

It would have really helped to know what the error was, but I believe I have found it anyway.

This line

public void actionperformed(ActionEvent event)

should be

public void actionPerformed(ActionEvent event)

Notice the capital "P". Without that, you claim to be implementing ActionListener on line four, but since you do not include that method (which is part of the implemented interface) then have not implemented it, hence the error on line 4.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.