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 javax.swing.event.*;
import java.awt.geom.*;


public class  liste extends JApplet implements ListSelectionListener 
{
  Container c;
  JPanel inputPanel;
  JList renklistesi;
  String renkisimleri[]={"siyah","Mavi","camgöbeği","Koyu Gri","Gri",
         "Yeşil","Açık gri","Mor","Portakal","Pembe","Kırmızı","beyaz","sarı"};
  Color renkler[]={Color.black,Color.blue,Color.cyan,Color.darkGray,Color.gray,
	     Color.green,Color.lightGray,Color.magenta,Color.orange,Color.pink,
	     Color.red,Color.white,Color.yellow};
  
  public void init()
  {    
	renklistesi=new JList(renkisimleri);
	renklistesi.setVisibleRowCount(5);
    c=getContentPane();
    inputPanel=new JPanel();
    inputPanel.add(new JScrollPane(renklistesi));
    c.add(inputPanel);
    renklistesi.addListSelectionListener(this);
  }


public void valueChanged( ListSelectionEvent e)
{
Color r1=renkler[renklistesi.getSelectedIndex()];
inputPanel.setBackground(r1);
c.setBackground(r1);
repaint();
}

    public static void main(String s[])
    {
        JFrame f = new JFrame("liste kontrol programı");
        f.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {System.exit(0);}
        });
        JApplet applet = new liste();
        f.getContentPane().add("Center", applet);
        applet.init();
        f.pack();
        f.setSize(new Dimension(545,400));
        f.setVisible(true);
    }
}





