import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class jevent extends Applet implements ActionListener
{
String msg="";
Button yes,no,maybe;
public void init()
{
yes=new Button("YES");
no=new Button("NO");
maybe=new Button("UNDECIDED");
add(yes);add(no);add(maybe);
yes.addActionListener(this);
no.addActionListener(this);
maybe.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String str=ae.getActionCommand();
if(str.equals("YES"))
{
msg="YOU've Clicked On YES";
}else if(str.equals("NO"))
{
msg="YOU've Clicked On NO";
}else
{
msg="Why Are You In Confusion?";
}
repaint();
}
public void paint(Graphics g)
{
g.drawString(msg,6,100);
}
}
Comments
Post a Comment