import java.io.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;


public class  control_boxP3 extends JPanel implements ItemListener
{
  JPanel inputPanel;
  JTextField t;
  JCheckBox red,blue,green;
  Color c[]={Color.red,Color.blue,Color.green};
  String s;
  
  public control_boxP3()
  {    
	s="Change the color of text";
    inputPanel=new JPanel();
    t=new JTextField(s,40);
	t.setFont(new Font("TimesRoman",Font.BOLD,24));   
    inputPanel.add(t);
    red=new JCheckBox("red");
    blue=new JCheckBox("blue");
    green=new JCheckBox("green");
    inputPanel.add(red);
    inputPanel.add(blue);
    inputPanel.add(green); 
    add(inputPanel);
    red.addItemListener(this);
    blue.addItemListener(this);
    green.addItemListener(this);
  }

public void itemStateChanged(ItemEvent e)
{   if(e.getSource()==red)
    { if(e.getStateChange()==ItemEvent.SELECTED)
        {t.setBackground(c[0]);}
    }
    else if(e.getSource()==blue)
    { if(e.getStateChange()==ItemEvent.SELECTED)
	    {t.setBackground(c[1]);}}
    else if(e.getSource()==green)
    {   if(e.getStateChange()==ItemEvent.SELECTED)
	    t.setBackground(c[2]);}
    else
        {t.setBackground(Color.black);}
    repaint();
}

}
