
hi,
here is my code:
import java.awt.Container; import java.awt.FlowLayout; import java.awt.TextField; import java.awt.event.ActionEvent; import java.awt.event.ActionListener;
import javax.swing.ImageIcon; import javax.swing.JApplet; import javax.swing.JButton;
public class abc extends JApplet implements ActionListener {
TextField t;
public void init()
{
ImageIcon i1=new ImageIcon("i1.gif");
JButton b1=new JButton(i1);
Container c=getContentPane();
c.setLayout(new FlowLayout());
b1.setActionCommand("butterfly");
b1.addActionListener(this);
c.add(b1);
c.add(t);
}
public void ActionPerformed(ActionEvent e)
{
t.setText(e.getActionCommand());
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.