import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
public class Buttons1 extends Applet implements ActionListener{
Button bt1, bt2;
String s;
public void init(){
bt1=new Button("Kitrino");
add(bt1);
bt1.addActionListener(this);
bt2=new Button("Kokkino");
add(bt2);
bt2.addActionListener(this);
}
public void paint (Graphics g){
if (s=="Kitrino")
setBackground(Color.yellow);
else if (s=="Kokkino")
setBackground(Color.red);
repaint();
}
public void actionPerfomed(ActionEvent e){
s=e.getActionCommand();
}
}
Thursday, July 16, 2009
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment