senewimala1988

Well-known member
  • Dec 5, 2007
    7,708
    2,578
    113
    Kadawatha, Sri Lanka
    anybody knows Java applet.Please help me to find the error of the following.I think the red coloured statement has an error.

    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    //<applet code="ex35.class" width=200 height=200>
    //</applet>
    public class ex35 extends Applet implements ActionListener
    {
    Label LH1,LH2,L1,L2,L3,L4,L5;
    TextField T1,T2,T3,T4;
    Button B1;
    float no2,no3,no4;
    public void init ()
    {
    setLayout(new GridLayout(6,2));
    setFont(new Font("Arial",Font.BOLD,22));
    LH1=new Label("Salary");
    LH2=new Label("");
    L1=new Label("Employee No. :");
    T1=new TextField(20);
    L2=new Label("Hours worked");
    T2=new TextField(20);
    L3=new Label("Hourly Rate:");
    T3=new TextField(20);
    L4=new Label("Gross Wage");
    T4=new TextField(20);
    L5=new Label("");
    B1=new Button("Calculate");
    add(LH1);
    LH1.setFont(new Font("Calibri",Font.BOLD,30));
    add(LH2);
    add(L1);
    add(T1);
    add(L2);
    add(T2);
    add(L3);
    add(T3);
    add(L4);
    add(T4);
    add(L5);
    add(B1);
    B1.addActionListener(this);
    }
    public void actionPerfomed(ActionEvent e)
    {
    if(e.getSource()==B1)
    {
    no2=Float.parseFloat(T2.getText());
    no3=Float.parseFloat(T3.getText());
    no4=no2*no3;
    T4.setText(String.value Of(no4));
    }
    }
    }
     

    heshan123

    Member
    Jan 12, 2007
    3,422
    3
    0
    40
    SrI lAnKa
    public void actionPerfomed(ActionEvent e)

    You have a bloody spelling mistake in here. Thats y ur program is not working.
     
    Last edited:

    senewimala1988

    Well-known member
  • Dec 5, 2007
    7,708
    2,578
    113
    Kadawatha, Sri Lanka
    heshan123 said:
    mokadda error eka?

    D:\IDM\Java\ex35.java:6: ex35 is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
    public class ex35 extends Applet implements ActionListener
    ^
    1 error
    Tool completed with exit code 1
     

    heshan123

    Member
    Jan 12, 2007
    3,422
    3
    0
    40
    SrI lAnKa
    senewimala1988 said:
    D:\IDM\Java\ex35.java:6: ex35 is not abstract and does not override abstract method actionPerformed(java.awt.event.ActionEvent) in java.awt.event.ActionListener
    public class ex35 extends Applet implements ActionListener
    ^
    1 error
    Tool completed with exit code 1
    since you have a spelling error in you actionPerformed method the compiler thinks its a another method you have written. Rectify your spelling error everything will be ok.