Even though I have extended the Applet class and Overridden the init() method am not getting the out put... Here is the program
//<Applet code=Applet2.java height=60 width=250> </applet>
import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.util.*;
class Applet2 extends Applet implements ActionListener
{
Button b1;
TextField tf;
Label l1;
public void init()
{
b1=new Button("OK");
tf=new TextField(20);
l1=new Label("NOW");
add(l1);
add(tf);
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
Date d=new Date();
tf.setText(d.toString());
}
}
> Thank you for the solution but I dont know how to
> override start() method. Will u help me by editting
> the code given above?
Did you write the above code or you copied it from somewhere. Just like you have overridden init override start( )
Just add this to the aboce code after the closing brace of the init method
public void start( )
{
// blahblahblah
}