Programlama | Programlama Dilleri | C Programlama Dili |C++



Listeden Renk Seçimi ?le Arkaplan Boyama

Java ile yaz?lm?? olan programda baz? renkler JList bile?eni içerisine yaz?lm?? ve uygun renklere dü?en as?l renkler ba?la bir dizi içinde tan?mlanm??t?r. Sonras?nda listeden t?klan?lan ifadeye göre uygun s?rada olan renk arkaplana aktar?lm??t?r.

 

  1. import java.awt.Color;
  2. import java.awt.Container;
  3. import java.awt.FlowLayout;
  4. import javax.swing.JFrame;
  5. import javax.swing.JList;
  6. import javax.swing.JScrollPane;
  7. import javax.swing.event.ListSelectionEvent;
  8. import javax.swing.event.ListSelectionListener;
  9.  
  10. /**
  11.  *
  12.  * @author NEO
  13.  */
  14. public class ListeRenkSecimi extends JFrame {
  15.    
  16.     private JList liste;
  17.     Container pencere=getContentPane();
  18.     private String renklistesi[]={"K?rm?z?","Mavi","Sar?","Ye?il","Gri","Siyah","Beyaz"};
  19.     private Color gercekrenkler[]={Color.RED,Color.BLUE,Color.YELLOW,Color.GREEN,Color.GRAY,Color.BLACK,Color.WHITE};
  20.     public ListeRenkSecimi()
  21.     {
  22.       super("Listeden Renk Seçimi");
  23.       liste= new JList(renklistesi);
  24.       pencere.setLayout(new FlowLayout());
  25.       pencere.add(new JScrollPane(liste));
  26.       liste.addListSelectionListener(new ListSelectionListener()
  27.       {
  28.        public void valueChanged(ListSelectionEvent event)
  29.        {
  30.         pencere.setBackground(gercekrenkler[liste.getSelectedIndex()]);
  31.        }
  32.  
  33.       });
  34.    
  35.       setSize(350,400) ;
  36.       setVisible(true);
  37.     }
  38.  
  39.     /**
  40.      * @param args the command line arguments
  41.      */
  42.     public static void main(String[] args) {
  43.         ListeRenkSecimi program=new ListeRenkSecimi();
  44.         program.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);  
  45.     }
  46. }

Yorumlar (0)
Sadece kayıtlı kullanıcılar yorum yazabilir!
Son Güncelleme ( Cumartesi, 27 Ekim 2012 00:15 )  
backlinktr.biz | 523: Origin is unreachable

Error 523 Ray ID: 5355377eac92d407 • 2019-11-14 01:29:51 UTC

Origin is unreachable

You

Browser

Working
Budapest

Cloudflare

Working
backlinktr.biz

Host

Error

What happened?

The origin web server is not reachable.

What can I do?

If you're a visitor of this website:

Please try again in a few minutes.

If you're the owner of this website:

Check your DNS Settings. A 523 error means that Cloudflare could not reach your host web server. The most common cause is that your DNS settings are incorrect. Please contact your hosting provider to confirm your origin IP and then make sure the correct IP is listed for your A record in your Cloudflare DNS Settings page. Additional troubleshooting information here.