import java.awt.*;
import java.awt.event.*;

public class testcores extends Frame implements ActionListener
{
	Button b1 = new Button("Botao 1");
	Button b2 = new Button("Botao 2");
	TextField red = new TextField(3);
	TextField green = new TextField(3);
	TextField blue = new TextField(3);
	TextField rgb = new TextField(3);
	
	public testcores()
	{
		super("Cor do botao");
		setSize(300,200);
		b1.setEnabled(false);
		b2.setEnabled(true);
		red.setEditable(false);
		green.setEditable(false);
		blue.setEditable(false);
		rgb.setEditable(false);
		setLayout(new GridLayout(5,2));
		add(b1);
		add(b2);
		add(new Label("Red: "));
		add(red);
		add(new Label("Green: "));
		add(green);
		add(new Label("Blue: "));
		add(blue);
		add(new Label("RGB: "));
		add(rgb);
		b1.addActionListener(this);
		b2.addActionListener(this);
		show();
		red.setText(String.valueOf(b1.getBackground().getRed()));
		green.setText(String.valueOf(b1.getBackground().getGreen()));
		blue.setText(String.valueOf(b1.getBackground().getBlue()));
		rgb.setText(String.valueOf(b1.getBackground().getRGB()));
	}
	public void actionPerformed(ActionEvent e)
	{
		Button org = (Button) e.getSource();
		red.setText(String.valueOf(org.getBackground().getRed()));
		green.setText(String.valueOf(org.getBackground().getGreen()));
		blue.setText(String.valueOf(org.getBackground().getBlue()));
		rgb.setText(String.valueOf(org.getBackground().getRGB()));
	}
	public static void main(String a[])
	{
		new testcores();
	}
}