import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class component_refresh extends Applet implements ActionListener {

Button[] button;
Button changeButton;
String[] buttonString= {"Even text", "Odd"};
int number = 10;
int count;
	
public void init() 
{
	setBackground(new Color(225,225, 200));
	button = new Button[number];
	for (int i=0; i<number; i++)
	{
		button[i] = new Button(buttonString[count%2]);
		add(button[i]);
	}
	changeButton = new Button("Change the text on the buttons");
	add(changeButton);
	changeButton.addActionListener(this);
}

public void actionPerformed(ActionEvent ae)
{
	if (ae.getSource() == changeButton) 
	{
		count++;
		for (int i=0; i<number; i++) button[i].setLabel(buttonString[count%2]);
		invalidate();
		validate();
	}
}
}  // END OF Class component_refresh
